InterstitialAdHandler

actual class InterstitialAdHandler(activity: Any?)
expect class InterstitialAdHandler(activity: Any?)

An InterstitialAdHandler is a full-screen ad that cover the interface of the host app. They're typically displayed at natural transition points in the flow of an app, such as between activities or during the pause between levels in a game. When an app shows an interstitial ad, the user has the choice to either tap on the ad and continue to its destination or close it and return to the app.

Parameters

activity

Android required Activity

// Instantiate
val ad = InterstitialAd(activity)
// Load the Ad
ad.load(
adUnitId = "AD_UNIT_ID_GOES_HERE", // Interstitial Ad Unit ID from AdMob
onLoad = {
// ad.setListeners could go here instead
},
onFailure = { } // Callback when ad fails to load
)
// (optional) Observe what happens to the ad after it's shown
ad.setListeners(
onFailure = {}, // Callback when ad fails to display
onDismissed = {}, // Callback when ad is dismissed
onShown = {}, // Callback after ad is shown
onImpression = {}, // Callback after the ad makes an impression
onClick = {} // Callback on ad click
)
// Show the ad
ad.show()

See also

actual class InterstitialAdHandler(activity: Any?)

Constructors

Link copied to clipboard
actual constructor(activity: Any?)
expect constructor(activity: Any?)
actual constructor(activity: Any?)

Properties

Link copied to clipboard
actual val state: AdState

Determines the AdState of the InterstitialAdHandler

expect val state: AdState

Determines the AdState of the InterstitialAdHandler

actual val state: AdState

Determines the AdState of the InterstitialAdHandler

Functions

Link copied to clipboard
actual fun load(adUnitId: String, onLoad: () -> Unit, onFailure: (Exception) -> Unit)
expect fun load(adUnitId: String = AdUnitId.INTERSTITIAL_DEFAULT, onLoad: () -> Unit, onFailure: (Exception) -> Unit)

Loads an Interstitial Ad. Note: Make all calls to the Mobile Ads SDK on the main thread.

actual fun load(adUnitId: String, onLoad: () -> Unit, onFailure: (Exception) -> Unit)
Link copied to clipboard
actual fun setListeners(onFailure: (Exception) -> Unit, onDismissed: () -> Unit, onShown: () -> Unit, onImpression: () -> Unit, onClick: () -> Unit)
expect fun setListeners(onFailure: (Exception) -> Unit, onDismissed: () -> Unit, onShown: () -> Unit = {}, onImpression: () -> Unit = {}, onClick: () -> Unit = {})

Sets the FullScreenContentCallback for the Interstitial Ad.

actual fun setListeners(onFailure: (Exception) -> Unit, onDismissed: () -> Unit, onShown: () -> Unit, onImpression: () -> Unit, onClick: () -> Unit)
Link copied to clipboard
actual fun show()
expect fun show()
actual fun show()