Builder for a AdLoader
.
Public Constructor Summary
Builder(Context
context, String adUnitID)
Creates a new
AdLoader.Builder
for constructing an AdLoader .
|
Public Method Summary
Inherited Method Summary
Public Constructors
public 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.Builder forAdManagerAdView (OnAdManagerAdViewLoadedListener listener, AdSize... adSizes)
Registers a listener to handle loading a Google Ad Manager banner ad.
Parameters
listener | The callback that will run when a banner ad loads. |
---|---|
adSizes | Sets the supported sizes of the banner ad. |
Throws
IllegalArgumentException | If adSizes is null or empty. |
---|
public AdLoader.Builder forAppInstallAd (NativeAppInstallAd.OnAppInstallAdLoadedListener listener)
This method is deprecated.
Use
forUnifiedNativeAd(UnifiedNativeAd.OnUnifiedNativeAdLoadedListener)
.
Parameters
listener | An object that handles displaying native app install ads. |
---|
public AdLoader.Builder forContentAd (NativeContentAd.OnContentAdLoadedListener listener)
This method is deprecated.
Use
forUnifiedNativeAd(UnifiedNativeAd.OnUnifiedNativeAdLoadedListener)
.
Parameters
listener | An object that handles displaying native content ads. |
---|
public AdLoader.Builder forCustomFormatAd (String customFormatId, NativeCustomFormatAd.OnCustomFormatAdLoadedListener adLoadedListener, NativeCustomFormatAd.OnCustomClickListener customClickListener)
Enables the AdLoader
to load custom format ads.
Parameters
customFormatId | Custom format ID defined in the Ad Manager UI. |
---|---|
adLoadedListener | A listener to be called when a NativeCustomFormatAd
loads. |
customClickListener | An optional listener to define custom click logic for ad clicks. When set, this overrides the ad's default click through behavior of navigating to the click URL defined in the Ad Manager UI. |
public AdLoader.Builder forCustomTemplateAd (String templateId, NativeCustomTemplateAd.OnCustomTemplateAdLoadedListener adLoadedListener, NativeCustomTemplateAd.OnCustomClickListener customClickListener)
This method is deprecated.
Use
forCustomFormatAd(String, NativeCustomFormatAd.OnCustomFormatAdLoadedListener,
NativeCustomFormatAd.OnCustomClickListener)
.
Enables the AdLoader
to load custom format ads.
Parameters
templateId | Custom format ID defined in the Ad Manager UI. |
---|---|
adLoadedListener | A listener to be called when a
NativeCustomTemplateAd loads. |
customClickListener | An optional listener to define custom click logic for ad clicks. When set, this overrides the ad's default click through behavior of navigating to the click URL defined in the Ad Manager UI. |
public AdLoader.Builder forNativeAd (NativeAd.OnNativeAdLoadedListener listener)
public AdLoader.Builder forPublisherAdView (OnPublisherAdViewLoadedListener listener, AdSize... adSizes)
This method is deprecated.
Use
forAdManagerAdView(OnAdManagerAdViewLoadedListener, AdSize)
.
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)
This method is deprecated.
Use
forNativeAd(NativeAd.OnNativeAdLoadedListener)
.
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 withAdManagerAdViewOptions (AdManagerAdViewOptions options)
Sets options to use for loading a Google Ad Manager ad view.
Parameters
options | Google Ad Manager banner ad options. |
---|
public AdLoader.Builder withNativeAdOptions (NativeAdOptions options)
Sets the native ad options to the ad loader builder.
Parameters
options | An object that specifies various native ad options. |
---|
public AdLoader.Builder withNativeAdOptions (NativeAdOptions options)
This method is deprecated.
Use
withNativeAdOptions(NativeAdOptions)
.
Parameters
options | An object that specifies various native ad options. |
---|
public AdLoader.Builder withPublisherAdViewOptions (PublisherAdViewOptions options)
This method is deprecated.
Use
withAdManagerAdViewOptions(AdManagerAdViewOptions)
.
Sets options to use for loading a Google Ad Manager ad view.
Parameters
options | Google Ad Manager banner ad options. |
---|