Interstitial Integration for Adobe Air

Get up and running with the Interstitial Ad Unit by completing a few simple steps:

  1. Implement the Listener
  2. Load Interstitial Ad
  3. Check Ad Availability
  4. Show Interstitial Ad

 

Before You Start
Make sure you have correctly integrated the ironSource Adobe Air Plugin. Integration is outlined here.

Step 1. Implement the Interstitial Listener

The ironSource Adobe Air Plugin fires several events to inform you of Interstitial Activity. To receive these events, you must implement the Interstitial EventListener:

IronSource.instance.addEventListener( "EventName", functionToCall  );
Note:

  1. EventName = a string containing the event you want to listen to.
  2. functionToCall = The function to call when the event is fired.

The ironSource Adobe Air Plugin will notify your Listener of all possible events listed below:

IronSource.instance.addEventListener(“onInterstitialAdReady”, onInterstitialAdReady);
IronSource.instance.addEventListener(“onInterstitialAdLoadFailed”, onInterstitialAdLoadFailed);
IronSource.instance.addEventListener(“onInterstitialAdOpened”, onInterstitialAdOpened);
IronSource.instance.addEventListener(“onInterstitialAdClosed”, onInterstitialAdClosed);              IronSource.instance.addEventListener(“onInterstitialAdShowSucceeded”, onInterstitialAdShowSucceeded);                IronSource.instance.addEventListener(“onInterstitialAdShowFailed”, onInterstitialAdShowFailed);
IronSource.instance.addEventListener(“onInterstitialAdClicked”, onInterstitialAdClicked);

Implementation:

/**
 * Invoked when Interstitial Ad is ready to be shown after load function was called.
 */
function onInterstitialAdReady(event:DataEvent):void {
            }
/**
 *Invoked when there is no Interstitial Ad available after calling load function.
 */
function onInterstitialAdLoadFailed(event:DataEvent):void {
 }
/**
 * Invoked right before the Interstitial screen is about to open.
 */
 function onInterstitialAdOpened(event:DataEvent):void {
 }
/**
 * Invoked when the interstitial ad closed and the user goes back to the application screen.
 */
 function onInterstitialAdClosed(event:DataEvent):void {
 }
/**
 * Invoked when the ad fails to show.
 * @param event.message - string - contains information about the failure.
 */
 function onInterstitialAdShowFailed(event:DataEvent):void {
 }
}
/**
 * Invoked when your end user clicks on the Interstitial ad
 */
function onInterstitialAdClicked(event:DataEvent):void {
 }
/**
 * Invoked when the ad was opened and shown successfully.
 */
function onInterstitialAdShowSucceeded(event:DataEvent):void {
 }
Note:

  • The onInterstitialAdOpened event conveys the ad format has taken over the app screen but does not indicate that an ad has been successfully served to your end-user.
  • The onInterstitialAdShowSucceeded event conveys an Interstitial Ad from ironSource or any other ad network was successfully served to your end-user.
  • ironSource provides an error code mechanism to help you understand errors you may run into during integration or live production. Extract the error data from the DataEvent object as follows:
    var errorCode:String;
    var errorDescription:String;
                    
    if(event.data){
       var error:Object = JSON.parse(event.data);
       errorDescription = error.error_description;
       errorCode = error.error_code;
    }

    See the complete description of the ironSource error codes here.

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.

Step 2. Load Interstitial Ad

We recommend requesting an Interstitial Ad a short while before you plan on showing it to your users as the loading process can take time.  
To request an interstitial ad, call the following method:

IronSource.instance.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 onInterstitialAdClosed event is fired, you will be able to load a new Interstitial ad.

Step 3. Check Ad Availability

After you’ve called the loadInterstitial in Step 2, you will be notified when the ad is loaded and ready to be shown to your user. The onInterstitialAdReady event will inform you about ad availability.

 function onInterstitialAdReady(event:DataEvent):void {
            }

In the case an Interstitial ad isn’t available you will receive the onInterstitialAdLoadFailed event:

function onInterstitialAdLoadFailed(event:DataEvent):void {
            }

Step 4. Show an Interstitial

Once there is an available Interstitial, you are ready to show this ad to your users by calling the following method:

IronSource.instance.showInterstitial();

With ironSource 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 below function to define the exact Placement you’d like to show an ad from. Navigate to the Ad Placement document for more details.

IronSource.instance.showInterstitial(YOUR_PLACEMENT_NAME);

In addition to ironSource Ad Placements, you can now configure capping and pacing settings for selected placements. Capping and pacing improves the user experience in your app by limiting the amount of ads served within a defined timeframe. Read more about capping and pacing here.

 

Done!
You are now all set to deliver Interstitial Ads in your application.

First Time Integration Tip

If this is a new integration for your application, your app will by default be in ‘Test Mode‘ on your ironSource dashboard. While your app is in Test Mode, the ironSourc SDK will print more logs to the console in order to provide greater visibility into the SDK processes. To test your ad inventory, set up your Test Devices. Until you turn on live ad inventory, you will receive test campaigns that don’t generate revenue. Make sure to select ‘Go Live! on the Ad Units page when your app is ready for live ad inventory.
Supersonic Switch App to Live Mode Rewarded Video Ad Unitironsource-go-live-with-rewarded-video


What’s Next?
Follow our integration guides to implement additional Ad Units: