Rewarded Ad Handler
An RewardedAdHandler 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 rewarded 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 = RewardedAd(activity)
// Load the Ad
ad.load(
adUnitId = "AD_UNIT_ID_GOES_HERE", // Rewarded 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()
Content copied to clipboard