RewardedInterstitialAd

interface RewardedInterstitialAd : Ad


Rewarded interstitials are full screen incentivized ads that reward users and appear automatically during natural app transitions.

Unlike com.google.android.libraries.ads.mobile.sdk.rewarded.RewardedAd, users aren’t required to opt-in to view a rewarded interstitial. Instead of the opt-in prompt in rewarded ads, rewarded interstitials require an intro screen that announces the reward and gives users a chance to opt-out if they wish to do so.

Summary

Public companion functions

suspend AdLoadResult<RewardedInterstitialAd>
load(adRequest: AdRequest)

Loads a RewardedInterstitialAd, suspending until a RewardedInterstitialAd successfully loads or fails to load.

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

Loads a RewardedInterstitialAd, providing the result via adLoadCallback.

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

Loads a RewardedInterstitialAd, providing the result via adLoadCallback.

Public functions

Bundle

Gets all available ad metadata for this RewardedInterstitialAd.

RewardItem

Gets the RewardItem for the loaded ad.

Unit
setImmersiveMode(immersiveModeEnabled: Boolean)

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

Unit

Sets ServerSideVerificationOptions for this RewardedInterstitialAd.

Unit
show(
    activity: Activity,
    onUserEarnedRewardListener: OnUserEarnedRewardListener
)

Shows the ad.

Public properties

RewardedInterstitialAdEventCallback?

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

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

Loads a RewardedInterstitialAd, suspending until a RewardedInterstitialAd successfully loads or fails to load.

Parameters
adRequest: AdRequest

An AdRequest with targeting information.

load

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

Loads a RewardedInterstitialAd, providing the result via adLoadCallback.

Parameters
adRequest: AdRequest

An AdRequest with targeting information.

adLoadCallback: AdLoadCallback<RewardedInterstitialAd>

A callback to be invoked when a rewarded interstitial ad finishes loading.

loadFromAdResponse

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

Loads a RewardedInterstitialAd, providing the result via adLoadCallback.

Parameters
adResponse: String

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

adLoadCallback: AdLoadCallback<RewardedInterstitialAd>

A callback to be invoked when loading completes.

Public functions

getAdMetadata

fun getAdMetadata(): Bundle

Gets all available ad metadata for this RewardedInterstitialAd. Ad metadata is empty if the loaded ad doesn't have metadata. Ad metadata may update after loading. Override RewardedInterstitialAdEventCallback.onAdMetadataChanged to listen for changes:

ad.adEventCallback = object : RewardedInterstitialAdEventCallback {
override fun onAdMetadataChanged() {
val metadata = ad.getAdMetadata()
}
}

getRewardItem

fun getRewardItem(): RewardItem

Gets the RewardItem for the loaded ad.

setImmersiveMode

fun setImmersiveMode(immersiveModeEnabled: Boolean): Unit

Sets a flag that controls if this ad will be displayed in immersive mode. Call this method before show. During 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.

setServerSideVerificationOptions

fun setServerSideVerificationOptions(
    options: ServerSideVerificationOptions
): Unit

Sets ServerSideVerificationOptions for this RewardedInterstitialAd.

show

fun show(
    activity: Activity,
    onUserEarnedRewardListener: OnUserEarnedRewardListener
): Unit

Shows the ad.

Parameters
activity: Activity

An Activity context from which to present the ad.

onUserEarnedRewardListener: OnUserEarnedRewardListener

The listener to be notified when user earns a reward.

Public properties

adEventCallback

var adEventCallbackRewardedInterstitialAdEventCallback?

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