Interstitial Ads are loaded automatically. You can observe ad loading events by specifying the delegate:
Copy val interstitial: BIDInterstitial ? = BIDInterstitial (activity)
interstitial?. setLoadDelegate (interstitialLoadDelegate)
The delegate should implement the following methods:
Copy var interstitialLoadDelegate : BIDFullLoad ? = object : BIDFullLoad {
override fun load (info: BIDAdInfo ) {
log ( "Interstitial - didLoadAd - adtag: ${ info.adTag } " )
}
override fun failLoad (info: BIDAdInfo , error: String ) {
log ( "Interstitial - didFailToLoadAd - adtag: ${ info.adTag } Error:$error" )
}
}
To show an interstitial ad, call showInterstitial
instance method:
Copy interstitial. showInterstitial (activity, showDelegate)
The delegate should implement the following methods:
Copy var fullShow : BIDFullShow ? = object : BIDFullShow {
override fun display (info: BIDAdInfo ) {
print ( "Interstitial - didDisplayAd. AdInfo: $adInfo" )
}
override fun click (info: BIDAdInfo ) {
print ( "Interstitial - didClickAd. AdInfo: $adInfo" )
}
override fun hide (info: BIDAdInfo ) {
print ( "Interstitial - didHideAd. AdInfo: $adInfo" )
}
override fun failToDisplay (info: BIDAdInfo , error: String ) {
print ( "Interstitial - failToDisplay. All networks fail to display - error: $error" )
}
override fun allNetworksFailedToDisplay () {
print ( "Interstitial - allNetworksDidFailToDisplayAd." )
}
}
Stopping and Starting Auto-Load
By default, Interstitials preload ads before any load attempt. So an Interstitial can use already preloaded ads instead of waiting on a manual load call to load new ads. To disable this feature you need to call the following method:
Copy interstitial. setAutoload ( false )
Once you disable autoload, you should load ads manually every time you need them to show:
Destroying of interstitial with resource release
Copy interstitial. destroy ()
Last updated 5 months ago