AdLoader.Builder

public class AdLoader.Builder 

Builder for a AdLoader .

Summary

Public constructors

Builder ( Context  context,  String  adUnitID)

Creates a new Builder for constructing an AdLoader .

Public methods

AdLoader
build ()

Returns an AdLoader or empty if there was an error was encountered.

AdLoader.Builder
@ CanIgnoreReturnValue
forAdManagerAdView (
    @ NonNull OnAdManagerAdViewLoadedListener  listener,
    AdSize[] adSizes
)

Registers a listener to handle loading a Google Ad Manager banner ad.

AdLoader.Builder

Enables the AdLoader to load custom format ads.

AdLoader.Builder

Registers a listener to handle loading a NativeAd .

AdLoader.Builder
AdLoader.Builder

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

AdLoader.Builder

Sets the native ad options to the ad loader builder.

Public constructors

Builder

public  Builder 
( Context 
 context,  String 
 adUnitID)

Creates a new Builder for constructing an AdLoader .

Parameters
Context  context

The context.

String  adUnitID

The ad unit ID.

Public methods

build

public  AdLoader 
 build 
()

Returns an AdLoader or empty if there was an error was encountered.

forAdManagerAdView

@ CanIgnoreReturnValue 

public  AdLoader.Builder forAdManagerAdView (
    @ NonNull OnAdManagerAdViewLoadedListener  listener,
    AdSize[] adSizes
)

Registers a listener to handle loading a Google Ad Manager banner ad.

Parameters
@ NonNull OnAdManagerAdViewLoadedListener  listener

The callback that will run when a banner ad loads.

AdSize[] adSizes

Sets the supported sizes of the banner ad.

Throws
java.lang.IllegalArgumentException

If adSizes is null or empty.

forCustomFormatAd

@ CanIgnoreReturnValue 

public  AdLoader.Builder forCustomFormatAd (
String  customFormatId,
NativeCustomFormatAd.OnCustomFormatAdLoadedListener  adLoadedListener,
    @ Nullable NativeCustomFormatAd.OnCustomClickListener  customClickListener
)

Enables the AdLoader to load custom format ads.

Parameters
String  customFormatId

Custom format ID defined in the Ad Manager UI.

NativeCustomFormatAd.OnCustomFormatAdLoadedListener  adLoadedListener

A listener to be called when a NativeCustomFormatAd loads.

@ Nullable NativeCustomFormatAd.OnCustomClickListener  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.

forNativeAd

@ CanIgnoreReturnValue 

public  AdLoader.Builder forNativeAd ( NativeAd.OnNativeAdLoadedListener  listener)

Registers a listener to handle loading a NativeAd .

Parameters
NativeAd.OnNativeAdLoadedListener  listener

A listener to be called when a NativeAd loads.

withAdListener

@ CanIgnoreReturnValue 

public  AdLoader.Builder withAdListener ( AdListener  listener)
Parameters
AdListener  listener

An object that handles errors encountered when retrieving native ads.

withAdManagerAdViewOptions

@ CanIgnoreReturnValue 

public  AdLoader.Builder withAdManagerAdViewOptions ( AdManagerAdViewOptions  options)

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

Parameters
AdManagerAdViewOptions  options

Google Ad Manager banner ad options.

withNativeAdOptions

@ CanIgnoreReturnValue 

public  AdLoader.Builder withNativeAdOptions ( NativeAdOptions  options)

Sets the native ad options to the ad loader builder.

Parameters
NativeAdOptions  options

An object that specifies various native ad options.

Create a Mobile Website
View Site in Mobile | Classic
Share by: