Show Ads
Showing Fullscreen Ads 🔗
The new Fullscreen APIs combine the existing Rewarded and Interstitial ad formats with the new Rewarded Interstitial ad format into a single integration experience. The older APIs have been marked deprecated, but are still functional until the 5.0.0 SDK release.
Once you receive the Fullscreen ad from the ad load request, you are ready to show it at your convenience.
-
// While in a coroutine val loadResult = // [from load] val showResult = loadResult.ad?.show(context)
-
// After loading an ad public void onAdLoaded(ChartboostMediationFullscreenAd ad) { ad.showFullscreenAdFromJava(context, new ChartboostMediationFullscreenAdShowListener() { public void onAdShown(ChartboostMediationAdShowResult result) { // Shown } ) }
Showing Banner Ads 🔗
Starting in version 3.0.0 of the Mediation SDK, the show()
method has been removed. Banners are automatically shown after being attached to a view hierarchy.
If you enable auto-refresh for banner placement in the dashboard, then the Mediation SDK will apply that setting when the placement is shown.
Any auto-refresh changes made on the dashboard will take approximately one hour to take effect and the SDK must be rebooted in order to pick up the changes once they’re available.
Releasing Mediation Ads 🔗
To clear resources used by Mediation Ads, you can use the destroy method associated with the respective Mediation Ad you have used.
-
override fun onDestroy() { ... // Release interstitial ad heliumInterstitialAd?.let { it.destroy(); Log("destroyed an existing interstitial"); } // Release rewarded ad heliumRewardedAd?.let { it.destroy(); Log("destroyed an existing rewarded"); } // Release banner ad heliumBannerAd?.let { it.destroy(); Log("destroyed an existing banner"); } ... }
-
@Override public void onDestroy() { ... // Release interstitial ad if (heliumInterstitialAd != null) { heliumInterstitialAd.destroy(); Log("destroyed an existing interstitial"); } // Release rewarded ad if (heliumRewardedAd != null) { heliumRewardedAd.destroy(); Log("destroyed an existing rewarded"); } // Release banner ad if (heliumBannerAd != null) { heliumBannerAd.destroy(); Log("destroyed an existing banner"); } ... }