AdLoader.Builder

public static classAdLoader.BuilderextendsObject

Builder for aAdLoader.

Public Constructor Summary

Builder(Context context,StringadUnitID)
Creates a newAdLoader.Builder for constructing anAdLoader.

Public Method Summary

AdLoader
build()
Returns anAdLoader or empty if there was an error was encountered.
AdLoader.Builder
forAdManagerAdView(OnAdManagerAdViewLoadedListener listener,AdSize... adSizes)
Registers a listener to handle loading a Google Ad Manager banner ad.
AdLoader.Builder
forCustomFormatAd(String customFormatId, NativeCustomFormatAd.OnCustomFormatAdLoadedListeneradLoadedListener, NativeCustomFormatAd.OnCustomClickListenercustomClickListener)
Enables theAdLoaderto load custom format ads.
AdLoader.Builder
forNativeAd(NativeAd.OnNativeAdLoadedListener listener)
Registers a listener to handle loading aNativeAd.
AdLoader.Builder
AdLoader.Builder
withAdManagerAdViewOptions(AdManagerAdViewOptions options)
Sets options to use for loading a Google Ad Manager ad view.
AdLoader.Builder
withNativeAdOptions(NativeAdOptions options)
Sets the native ad options to the ad loader builder.

Inherited Method Summary

Public Constructors

publicBuilder(Contextcontext, String adUnitID)

Creates a newAdLoader.Builder for constructing anAdLoader.

Parameters
context The context.
adUnitID The ad unit ID.

Public Methods

publicAdLoader build()

Returns anAdLoaderor empty if there was an error was encountered.

publicAdLoader.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 IfadSizesisnullor empty.

publicAdLoader.Builder forCustomFormatAd(String customFormatId, NativeCustomFormatAd.OnCustomFormatAdLoadedListeneradLoadedListener, NativeCustomFormatAd.OnCustomClickListenercustomClickListener)

Enables theAdLoaderto load custom format ads.

Parameters
customFormatId Custom format ID defined in the Ad Manager UI.
adLoadedListener A listener to be called when aNativeCustomFormatAd 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.

publicAdLoader.Builder forNativeAd(NativeAd.OnNativeAdLoadedListener listener)

Registers a listener to handle loading aNativeAd.

Parameters
listener A listener to be called when aNativeAd loads.

publicAdLoader.Builder withAdListener(AdListener listener)

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

publicAdLoader.Builder withAdManagerAdViewOptions(AdManagerAdViewOptions options)

Sets options to use for loading a Google Ad Manager ad view.

Parameters
options Google Ad Manager banner ad options.

publicAdLoader.Builder withNativeAdOptions(NativeAdOptions options)

Sets the native ad options to the ad loader builder.

Parameters
options An object that specifies various native ad options.