Android / Amazon HyprMX SDK
SDK Documentation
  • Getting Started
    • Android / Amazon Setup Guide
    • Privacy
    • Google's Data Safety Questionnaire
    • Migrate to Version 6.4+
  • Ad Formats
    • Rewarded Ads
    • Interstitial Ads
    • Banner/MREC Ads
  • 3rd Party Mediation
    • 3rd Party Mediation
      • AdMob Mediation
      • AppLovin MAX
      • Chartboost Mediation
      • Digital Turbine FairBid
      • Unity LevelPlay
      • X3M XMediator
  • Downloads/Change Log
    • Downloads
    • Change Log
      • Android SDK Change Log
      • Android AdMob Adapter Change Log
      • Android MAX Adapter Change Log
Powered by GitBook
On this page
  • What are Interstitial Ads?
  • How to Display Interstitial Ads
  • Integrate & Initialize HyprMX
  • Loading Interstitial Ads
  • Displaying Interstitial Ads
  1. Ad Formats

Interstitial Ads

This guide shows how to display Interstitial Ads in your application.

PreviousRewarded AdsNextBanner/MREC Ads

Last updated 1 month ago

What are Interstitial Ads?

Interstitial Ad Units are full-screen, interactive ads designed to be placed between content at a natural transition point.

How to Display Interstitial Ads

Integrate & Initialize HyprMX

Before you start, make sure you have correctly integrated and initialized the HyprMX SDK. To integrate and initialize HyprMX, see our .

Loading Interstitial Ads

HyprMX utilizes placements to load and display an ad. Placements are used to represent a point in your application's workflow where you'd like to show an ad. To load an ad to a placement, follow the steps below.

If you don't have your placement information, please reach out to your account manager to configure your interstitial placements. In return, they will provide the names of the new placements.

  1. Use the getPlacement API to retrieve a placement from HyprMX.

interstitialPlacement = HyprMX.INSTANCE.getPlacement("YOUR_INTERSTITIAL_PLACEMENT_NAME");
interstitialPlacement = HyprMX.getPlacement("YOUR_INTERSTITIAL_PLACEMENT_NAME")
  1. To check for availability, run the following:

interstitialPlacement.loadAd(new HyprMXLoadAdListener() {
  @Override
  public void onAdLoaded(boolean isAdAvailable) {
    if(isAdAvailable) {
      // You can show the ad
   }
  }
});
interstitialPlacement.loadAd(isAdAvailable -> {
   if(isAdAvailable) {
      // You can show the ad
   }
});
interstitialPlacement.loadAd { isAdAvailable ->
   if(isAdAvailable) {
      // You can show the ad
   }
}
val isAdAvailable = interstitialPlacement.loadAd()

if(isAdAvailable) {
    // You can show the ad
}

loadAd() will call back to your listener with: isAdAvailable == true when an ad is available or false when there is no inventory.

  1. To receive notification that the loaded ad has expired, implement the HyprMXPlacementExpiryListener

private HyprMXPlacementExpiryListener listener = new HyprMXPlacementExpiryListener() {
  @Override
  public void onAdExpired(@NonNull Placement placement) {
      // Do something on expiration
  }
}

interstitialPlacement.setPlacementExpiryListener(listener);
interstitialPlacement.setPlacementExpiryListener(placement -> {
   // Do something on expiration
});
val listener = object : HyprMXPlacementExpiryListener {
    override fun onAdExpired(placement: Placement) {
       // Do something on expiration
    }
}

interstitialPlacement.setPlacementExpiryListener(listener)

Displaying Interstitial Ads

  1. Before calling showAd on a placement, you should confirm the ad state is still valid:

interstitialPlacement.isAdAvailable();
interstitialPlacement.isAdAvailable()

When an ad is displaying, it is important to disable all in-game music and sounds so they do not interfere with the advertisements. You can disable them when your activity transitions to onStop and resume when your activity transitions to onResume.

  1. When you are ready to display an ad, call showAd to begin the presentation of an ad.

if (interstitialPlacement.isAdAvailable()) {
  interstitialPlacement.showAd(this);
}
if (interstitialPlacement.isAdAvailable()) {
  interstitialPlacement.showAd(this)
}
  1. To receive display status, implement the HyprMXShowListener:

/**
 * Called when an ad is shown for the given placement. Your application should pause here.
 */
@Override
public void onAdStarted(Placement placement) {}

/**
 * Called when an ad is closed. Your application should resume here.
 */
@Override
public void onAdClosed(Placement placement, boolean finished) {}

/**
 * Called when there was an error displaying the ad.
 */
@Override
public void onAdDisplayError(Placement placement, HyprMXErrors hyprMXError) {}

/**
 * Called when the ad was impressed.
 */
@Override
public void onAdImpression(Placement placement) {}
/**
 * Called when an ad is shown for the given placement. Your application should pause here.
 */
override fun onAdStarted(placement: Placement) {}

/**
 * Called when an ad is closed. Your application should resume here.
 */
override fun onAdClosed(placement: Placement, finished: Boolean) {}

/**
 * Called when there was an error displaying the ad.
 */
override fun onAdDisplayError(placement: Placement, hyprMXError: HyprMXErrors) {}

/**
 * Called when the ad was impressed.
 */
override fun onAdImpression(placement: Placement) {}

If you'd like, we can send server-to-server calls when ads are completed. Contact your account manager at HyprMX for more details.

Setup Guide