AdLoader.Builder

public static class AdLoader.Builder extends Object

Builder for a AdLoader.

Public Constructor Summary

AdLoader.Builder(Context context, String adUnitID)
Creates a new AdLoader.Builder for constructing an AdLoader.

Public Method Summary

AdLoader
AdLoader.Builder
AdLoader.Builder
AdLoader.Builder
AdLoader.Builder
AdLoader.Builder
AdLoader.Builder
AdLoader.Builder
AdLoader.Builder
AdLoader.Builder

Inherited Method Summary

Public Constructors

public AdLoader.Builder (Context context, String adUnitID)

Creates a new AdLoader.Builder for constructing an AdLoader.

Parameters
context The context.
adUnitID The ad unit ID.

Public Methods

public AdLoader build ()

Returns
  • A AdLoader or null if there was an error was encountered..

public AdLoader.Builder forAppInstallAd (NativeAppInstallAd.OnAppInstallAdLoadedListener listener)

Parameters
listener An object that handles displaying native app install ads.

public AdLoader.Builder forContentAd (NativeContentAd.OnContentAdLoadedListener listener)

Parameters
listener An object that handles displaying native content ads.

public AdLoader.Builder forCustomTemplateAd (String templateId, NativeCustomTemplateAd.OnCustomTemplateAdLoadedListener adLoadedListener, NativeCustomTemplateAd.OnCustomClickListener customClickListener)

Parameters
templateId Custom template Id defined in the DFP front end.
adLoadedListener An object that handles displaying native custom template ads.
customClickListener An optional listener that handles custom clicks on custom template ads.

public AdLoader.Builder forPublisherAdView (OnPublisherAdViewLoadedListener listener, AdSize... adSizes)

Parameters
listener An object that handles displaying banner ads.
adSizes Sets the supported sizes of the banner ad.
Throws
IllegalArgumentException If adSizes is null or empty.

public AdLoader.Builder forUnifiedNativeAd (UnifiedNativeAd.OnUnifiedNativeAdLoadedListener listener)

Registers a listener to handle UnifiedNativeAd. The UnifiedNativeAd should be shown in UnifiedNativeAdView or NativeAdViewHolder.

Parameters
listener An object that handles displaying native ads.

public AdLoader.Builder withAdListener (AdListener listener)

Parameters
listener An object that handles errors encountered when retrieving native ads.

public AdLoader.Builder withCorrelator (Correlator correlator)

Parameters
correlator A Correlator to attach with this loader. This parameter cannot be null.

public AdLoader.Builder withNativeAdOptions (NativeAdOptions options)

Parameters
options An object that specifies various native ad options.

public AdLoader.Builder withPublisherAdViewOptions (PublisherAdViewOptions options)

Parameters
options An object that specifies various DFP banner ad options.

Send feedback about...

Need help? Visit our support page.