onAdShown

abstract fun onAdShown(event: ShowEvent, error: ShowError?)

Called after a show call, either if the ad has been presented and an ad impression logged, or if the operation failed. Implement this method to be notified when the ad presentation process has finished. This method will be called once for each call to show on an interstitial or rewarded ad. In contrast, this may be called multiple times after showing a banner, either if some error occurs after the ad has been successfully shown or as a result of the banner's automatic content refresh.

A common practice is to cache an ad here so there's an ad ready for the next time you need to show it. Note that this is not necessary for banners with automaticallyRefreshesContent set to TRUE.

fun onAdShown(event: ShowEvent, error: ShowError?) {
if (error != null) {
// Handle error, possibly resuming processes paused in willShowAd:
} else {
event.ad.cache()
}
}

Parameters

event

A show event with information related to the ad shown.

error

An error specifying the failure reason, or null if the operation was successful.