AppOpenAd

interface AppOpenAd : Ad


App open ads are used to monetize app load screens. 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 load to load an AppOpenAd and then call show to display it.

Summary

Public companion functions

suspend AdLoadResult<AppOpenAd>
load(adRequest: AdRequest)

Loads an AppOpenAd, suspending until an AppOpenAd successfully loads or fails to load.

Unit
load(adRequest: AdRequest, adLoadCallback: AdLoadCallback<AppOpenAd>)

Loads an AppOpenAd, providing the result via adLoadCallback.

Unit
loadFromAdResponse(
    adResponse: String,
    adLoadCallback: AdLoadCallback<AppOpenAd>
)

Loads an AppOpenAd, providing the result via adLoadCallback.

Public functions

Unit
setImmersiveMode(immersiveModeEnabled: Boolean)

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

Unit
show(activity: Activity)

Shows the ad.

Public properties

AppOpenAdEventCallback?

Optional callback for ad events during the lifecycle of this AppOpenAd.

Inherited functions

From com.google.android.libraries.ads.mobile.sdk.common.Ad
Unit

Destroys the ad, stopping any extra processing and destroying resources associated with the ad.

ResponseInfo

Gets information about the ad response for this ad.

Inherited properties

From com.google.android.libraries.ads.mobile.sdk.common.Ad
Long

An identifier for a placement in reporting.

Public companion functions

load

suspend fun load(adRequest: AdRequest): AdLoadResult<AppOpenAd>

Loads an AppOpenAd, suspending until an AppOpenAd successfully loads or fails to load.

Parameters
adRequest: AdRequest

An AdRequest with targeting information.

Returns
AdLoadResult<AppOpenAd>

AdLoadResult.Success if the load succeeded, AdLoadResult.Failure otherwise.

load

fun load(adRequest: AdRequest, adLoadCallback: AdLoadCallback<AppOpenAd>): Unit

Loads an AppOpenAd, providing the result via adLoadCallback.

Parameters
adRequest: AdRequest

An ad request with targeting information.

adLoadCallback: AdLoadCallback<AppOpenAd>

A callback to be invoked when the ad finishes loading.

loadFromAdResponse

fun loadFromAdResponse(
    adResponse: String,
    adLoadCallback: AdLoadCallback<AppOpenAd>
): Unit

Loads an AppOpenAd, providing the result via adLoadCallback.

Parameters
adResponse: String

An ad response from a server-to-server ad request.

adLoadCallback: AdLoadCallback<AppOpenAd>

A callback to be invoked when loading completes.

Public functions

setImmersiveMode

fun setImmersiveMode(immersiveModeEnabled: Boolean): Unit

Sets a flag that controls if this ad will be displayed in immersive mode. Call this method before AppOpenAd.show. During AppOpenAd.show, if this flag is on and immersive mode is supported, the ad will turn on the SYSTEM_UI_FLAG_IMMERSIVE_STICKY & SYSTEM_UI_FLAG_HIDE_NAVIGATION flags.

show

fun show(activity: Activity): Unit

Shows the ad.

Parameters
activity: Activity

An Activity context from which to present the ad.

Public properties

adEventCallback

var adEventCallbackAppOpenAdEventCallback?

Optional callback for ad events during the lifecycle of this AppOpenAd.