Skip to main content

Rewarded Ad

Loading an Rewarded Ad

To load an rewarded ad, create a RewardedAd instance. Important: for a single instance of an RewardedAd, load() and show() can only be called once. Create new instance for every new interstitial ad.

val rewarded = RewardedAd()

Set RewardedListener for receiving all-related events, including loading/displaying and revenue callbacks.

rewarded.setRewardedListener(object : RewardedListener {
override fun onAdLoaded(ad: Ad) {
// ready to show
}

override fun onAdLoadFailed(cause: BidonError) {
}

override fun onAdShowFailed(cause: BidonError) {
}

override fun onAdShown(ad: Ad) {
}

override fun onAdClicked(ad: Ad) {
}

override fun onAdClosed(ad: Ad) {
}

override fun onAdExpired(ad: Ad) {
}

override fun onUserRewarded(ad: Ad, reward: Reward?) {
// reward - contains reward data if exist
}

override fun onRevenuePaid(ad: Ad, adValue: AdValue) {
// adValue.revenue - ad revenue from mediation
}
})
rewarded.loadAd(this@MainActivity, pricefloor) // or use DefaultMinPrice

Displaying interstitial ad

if (rewarded.isReady()) {
rewarded.showAd(activity = this)
}