public final class

Correlator

extends Object
java.lang.Object
   ↳ com.google.android.gms.ads.Correlator

Class Overview

A Correlator is used to associate multiple ad views on the same page. When the same Correlator is attached to multiple ad objects, on the next ad load or refresh, they will start serving correlated ads.

This code provides a sample on how this class is used for two banners that should serve correlated ads:

     Correlator correlator = new Correlator();

     PublisherAdView topBannerView = new PublisherAdView(this);
     topBannerView.setAdSize(...);
     topBannerView.setAdUnitId(...);
     topBannerView.setCorrelator(correlator);

     PublisherAdView bottomBannerView = new PublisherAdView(this);
     bottomBannerView.setAdSize(...);
     bottomBannerView.setAdUnitId(...);
     bottomBannerView.setCorrelator(correlator);

     topBannerView.loadAd(adRequest);
     bottomBannerView.loadAd(adRequest);
If the app wants to load a different set of correlated ads, the refresh can be forced as following:
     correlator.reset();
     topBannerView.loadAd(adRequest);
     bottomBannerView.loadAd(adRequest);

See also:

Summary

Public Constructors
Correlator()
Create a new Correlator.
Public Methods
void reset()
Reset this Correlator object.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Correlator ()

Create a new Correlator.

Public Methods

public void reset ()

Reset this Correlator object. The ad views attached to it will not be forced refreshed, however on the next load or refresh, they will start serving a new set of correlated ads. This method essentially starts a new page view for the attached ad views.