Interstitial Integration for Android Legacy pre v8.4.0

The Unity LevelPlay Interstitial is a full-screen ad unit, usually served at natural transition points during the app lifecycle. We support both static and video interstitials. You can also serve interstitials through the Unity LevelPlay Mediation.

Before you start

Make sure that you have correctly integrated the ironSource SDK into your application. Integration is outlined here. The multiple ad units APIs are available here, supported for SDK 8.4.0+

Step 1. Implement the Listener

The ironSource SDK fires several events to inform you of Interstitial activity. The SDK will notify your delegate of all possible events listed below:

IronSource.setLevelPlayInterstitialListener(new LevelPlayInterstitialListener() {
   // Invoked when the interstitial ad was loaded successfully.
   // AdInfo parameter includes information about the loaded ad   
   @Override
   public void onAdReady(AdInfo adInfo) {}
   // Indicates that the ad failed to be loaded 
   @Override
   public void onAdLoadFailed(IronSourceError error) {}
   // Invoked when the Interstitial Ad Unit has opened, and user left the application screen.
   // This is the impression indication. 
   @Override
   public void onAdOpened(AdInfo adInfo) {}
   // Invoked when the interstitial ad closed and the user went back to the application screen.
   @Override
   public void onAdClosed(AdInfo adInfo) {}
   // Invoked when the ad failed to show 
   @Override
   public void onAdShowFailed(IronSourceError error, AdInfo adInfo) {}
   // Invoked when end user clicked on the interstitial ad
   @Override
   public void onAdClicked(AdInfo adInfo) {}
   // Invoked before the interstitial ad was opened, and before the InterstitialOnAdOpenedEvent is reported.
   // This callback is not supported by all networks, and we recommend using it only if  
   // it's supported by all networks you included in your build. 
   @Override
   public void onAdShowSucceeded(AdInfo adInfo){}
});
Note:
  • Do not assume the callbacks are always running on the main thread. Any UI interaction or updates resulting from ironSource callbacks need to be passed to the main thread before executing.
  • Please make sure to set the listeners before SDK initialization. This will ensure the SDK sends all relevant information. 

You can view the full listeners implementation here.

Step 2. Load Interstitial Ad

We recommend requesting an interstitial ad after receiving the init success callback. To request an interstitial ad, call the following method:

IronSource.loadInterstitial();

Note:  If you’d like to serve several Interstitial Ads in your application, you must repeat this step after you’ve shown and closed the previous Interstitial Ad. Once the onAdClosed function is fired, you will be able to load a new Interstitial ad.

Step 3. Check Ad Availability

After you call the loadInterstitial in Step 2, you will be notified when the ad is loaded and ready to be shown to your user through the delegate with the method onAdReady which will inform you about ad availability.

public void onAdReady(){}

In addition, you can also ask for the ad availability directly by calling the following function:

 boolean isInterstitialReady();

We don’t recommend making consecutive requests for an interstitial ad in a short timespan. Numerous requests in a short period of time have no added value as the chance of available inventory at this time is unlikely.

Once the Interstitial ad is available you will be able to show the ad to your users. With LevelPlay‘s Ad Placements, you can customize and optimize the Interstitial experience. This tool enables you to present Interstitial ads to your users in different places, i.e. app launch, between levels, etc. You can use the function in the next step to define the exact Placement you’d like to show an ad from. In addition, to receive details about a specific Ad Placement, you can call the following:

InterstitialPlacement getInterstitialPlacementInfo(String placementName)

In addition to LevelPlay‘s Ad Placements, you can now configure capping and pacing settings for selected placements. Capping and pacing improve the user experience in your app by limiting the number of ads served within a defined timeframe.

We recommend calling the following to verify if a placement is capped before you serve the Interstitial to your user:

IronSource.isInterstitialPlacementCapped(placementName)

Navigate to the Ad Placement document for more details.

Step 4. Show Interstitial Ad

Once you receive the onInterstitialAdReady callback, you are ready to show an Interstitial Ad to your users. To provide the best experience for your users, make sure to pause any game action, including audio, during the time the ad is displayed.

Invoke the following method to serve an Interstitial ad to your users:

IronSource.showInterstitial(placementName);
Once you’ve successfully completed step 4, you will have shown your user an Interstitial Ad. In the case you want to serve another Interstitial ad, you must repeat Step 3 to request an additional Interstitial.

Done!
You can now deliver Interstitial Ads on your app!


What’s Next?
Follow our integration guides to integrate additional Interstitial Ad networks or configure additional Ad Units: