AppOpenAd

public abstract class AppOpenAd


App open ads are used to display ads when users enter your app. An AppOpenAd object contains all the data necessary to display an ad. Unlike interstitial ads, app open ads make it easy to provide an app branding area so that users understand the context in which they see the ad. Use one of the static load methods to load an AppOpenAd. Then call show to render it.

Summary

Nested types

public abstract class AppOpenAd.AppOpenAdLoadCallback extends AdLoadCallback

An object for receiving event notifications for loading an app open ad.

Public constructors

Public methods

abstract @NonNull String

Returns the ad unit ID.

abstract @Nullable FullScreenContentCallback

Gets the FullScreenContentCallback for this AppOpenAd.

abstract @Nullable OnPaidEventListener

Gets the OnPaidEventListener for this AppOpenAd.

abstract @NonNull ResponseInfo

Returns the ResponseInfo for the loaded ad.

static boolean
isAdAvailable(@NonNull Context context, @NonNull String adUnitId)

Returns true if there is an available app open ad loaded from startPreload.

static void
load(
    Context context,
    String adUnitId,
    AdRequest adRequest,
    AppOpenAd.AppOpenAdLoadCallback loadCallback
)

Loads an AppOpenAd.

static @Nullable AppOpenAd
pollAd(@NonNull Context context, @NonNull String adUnitId)

Retrieves the next app open ad loaded from startPreload, or null if no ad is available.

abstract void

Registers a callback to be invoked when ads show and dismiss full screen content.

abstract void
setImmersiveMode(boolean immersiveModeEnabled)

Sets a flag that controls if this app open ad object will be displayed in immersive mode.

abstract void

Registers a callback to be invoked when this ad is estimated to have earned money.

abstract void
show(@NonNull Activity activity)

Shows the AppOpenAd.

Public constructors

AppOpenAd

public AppOpenAd()

Public methods

getAdUnitId

public abstract @NonNull String getAdUnitId()

Returns the ad unit ID.

getFullScreenContentCallback

public abstract @Nullable FullScreenContentCallback getFullScreenContentCallback()

Gets the FullScreenContentCallback for this AppOpenAd.

getOnPaidEventListener

public abstract @Nullable OnPaidEventListener getOnPaidEventListener()

Gets the OnPaidEventListener for this AppOpenAd.

getResponseInfo

public abstract @NonNull ResponseInfo getResponseInfo()

Returns the ResponseInfo for the loaded ad.

isAdAvailable

public static boolean isAdAvailable(@NonNull Context context, @NonNull String adUnitId)

Returns true if there is an available app open ad loaded from startPreload.

load

public static void load(
    Context context,
    String adUnitId,
    AdRequest adRequest,
    AppOpenAd.AppOpenAdLoadCallback loadCallback
)

Loads an AppOpenAd.

Parameters
Context context

The context.

String adUnitId

The ad unit ID.

AdRequest adRequest

An ad request with targeting information.

AppOpenAd.AppOpenAdLoadCallback loadCallback

An object that handles events for loading an app open ad.

pollAd

public static @Nullable AppOpenAd pollAd(@NonNull Context context, @NonNull String adUnitId)

Retrieves the next app open ad loaded from startPreload, or null if no ad is available.

setFullScreenContentCallback

public abstract void setFullScreenContentCallback(
    @Nullable FullScreenContentCallback fullScreenContentCallback
)

Registers a callback to be invoked when ads show and dismiss full screen content.

setImmersiveMode

public abstract void setImmersiveMode(boolean immersiveModeEnabled)

Sets a flag that controls if this app open ad object will be displayed in immersive mode. Call this method before show. During show time, if this flag is on and immersive mode is supported, SYSTEM_UI_FLAG_IMMERSIVE_STICKY &SYSTEM_UI_FLAG_HIDE_NAVIGATION will be turned on for the app open ad.

setOnPaidEventListener

public abstract void setOnPaidEventListener(@Nullable OnPaidEventListener listener)

Registers a callback to be invoked when this ad is estimated to have earned money.

show

public abstract void show(@NonNull Activity activity)

Shows the AppOpenAd.

Parameters
@NonNull Activity activity

The activity from which the AppOpenAd is shown from.