Showing Interstitial and Rewarded Ads

When you’re ready to show a rewarded or interstitial ad, you can check that it’s ready to show and then display it like so:

//Showing a Helium Interstitial Ad
if (this.interstitialAd.readyToShow()){
  this.interstitialAd.show();
}
else {
  //when there’s no Helium Ad ready to show immediately,
  //fall through to your chosen backup behavior
  this.interstitialAd.load();
}

//Showing a Helium Rewarded Ad
if (this.rewardedAd.readyToShow()){
  this.rewardedAd.show();
}
else {
  //when there’s no Helium Ad ready to show immediately,
  //fall through to your chosen backup behavior
  this.rewardedAd.load();
}

Showing Banner Ads

When you’re ready to show a banner ad, you can check that it’s ready to show and then display it by also passing a HeliumBannerAdScreenLocation position:

Banner Ad Location EnumEnum ValuePosition
HeliumBannerAdScreenLocation.TopLeft0Positions the banner to the top-left screen of the device.
HeliumBannerAdScreenLocation.TopCenter1Positions the banner to the top-center screen of the device.
HeliumBannerAdScreenLocation.TopRight2Positions the banner to the top-right screen of the device.
HeliumBannerAdScreenLocation.Center3Positions the banner to the center screen of the device.
HeliumBannerAdScreenLocation.BottomLeft4Positions the banner to the bottom-left screen of the device.
HeliumBannerAdScreenLocation.BottomCenter5Positions the banner to the bottom-left screen of the device.
HeliumBannerAdScreenLocation.BottomRight6Positions the banner to the bottom-right screen of the device.
if (this.bannerAd.readyToShow())
{
    //Showing a Helium Banner Ad in the bottom-center of the device.
    HeliumBannerAdScreenLocation screenPos screenPos = HeliumBannerAdScreenLocation.BottomCenter;
    this.bannerAd.show(screenPos);
}
else
{
    //When there’s no Helium Ad ready to show immediately,
    //fall through to your chosen backup behavior
    Log("Banner is not ready to load.");
}

If you enable auto-refresh for a banner placement in the dashboard, then the Mediation SDK will apply that setting when the placement is shown.

📘

Note

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.

void OnDestroy()
{
    // Release Interstitial Ad
    if (interstitialAd != null)
    {
        interstitialAd.clearLoaded();
        interstitialAd.destroy();
        Log("destroyed an existing interstitial");
    }
    
    // Release Rewarded Ad
    if (rewardedAd != null)
    {
        rewardedAd.clearLoaded();
        rewardedAd.destroy();
        Log("destroyed an existing rewarded");
    }
    
    // Release Banner Ad
    if (bannerAd != null)
    {
        bannerAd.clearLoaded();
        bannerAd.destroy();
        Log("destroyed an existing banner");
    }
}