InterstitialAd

interface InterstitialAd : Ad


A full page ad experience at natural transition points such as a page change, an app launch, or a game level load. Interstitials use a close button that removes the ad from the user's experience.

Summary

Public companion functions

suspend AdLoadResult<InterstitialAd>
load(adRequest: AdRequest)

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

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

Loads an InterstitialAd, providing the result via adLoadCallback.

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

Loads an InterstitialAd, providing the result via adLoadCallback.

Public functions

Unit
setImmersiveMode(immersiveModeEnabled: Boolean)

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

Unit
show(activity: Activity)

Shows the interstitial ad.

Public properties

InterstitialAdEventCallback?

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

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<InterstitialAd>

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

Parameters
adRequest: AdRequest

An AdRequest with targeting information.

Returns
AdLoadResult<InterstitialAd>

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

load

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

Loads an InterstitialAd, providing the result via adLoadCallback.

Parameters
adRequest: AdRequest

An ad request with targeting information.

adLoadCallback: AdLoadCallback<InterstitialAd>

A callback to be invoked when an interstitial ad finishes loading.

loadFromAdResponse

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

Loads an InterstitialAd, providing the result via adLoadCallback.

Parameters
adResponse: String

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

adLoadCallback: AdLoadCallback<InterstitialAd>

A callback to be invoked when loading completes.

Public functions

setImmersiveMode

fun setImmersiveMode(immersiveModeEnabled: Boolean): Unit

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

show

fun show(activity: Activity): Unit

Shows the interstitial ad.

Parameters
activity: Activity

An Activity context from which to present the ad.

Public properties

adEventCallback

var adEventCallbackInterstitialAdEventCallback?

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