Interstitial

Before You Start

Before integrating ads unit in your app, you must:
 

New in Version 6.0.0!

For Rewarded Video, Interstitial and Interactive Ad, the SDK will cache ads automatically and maintain ad inventory regularly, such as pre-loading after initialization, loading after ad served and timing loading etc. You have no need to invoke load method to cache ads by yourselves anymore with version 6.x.x. The new APIs are easier to use.

Interstitial 

The AdTiming Interstitial is a full-screen ad unit, usually served at natural transition points during an app's lifecycle. Both static and video interstitials are supported.

InterstitialAd Formats:

interstitial_ad_1.png      

interstitial_ad_2.png

 

Step 1. Set the Interstitial Ad Listener

The AdTiming SDK fires several events to inform you of Interstitial Ad activity, such as ad availability and clicked. To serve Interstitial Ad, you need to first set its listeners and process ad events. The following snippet demonstrates how to implement the InterstitialAdListener interface to receive interstitial ad events.

The SDK will notify the Listener of all possible events listed below:

import com.adtiming.mediationsdk.interstitial.AdTimingInterstitialAd;
import com.adtiming.mediationsdk.interstitial.InterstitialAdListener;
import com.adtiming.mediationsdk.utils.error.AdTimingError;
import com.adtiming.mediationsdk.utils.model.Scene;
...
AdTimingInterstitialAd.setAdListener(new InterstitialAdListener() {

  /**
   * Invoked when the interstitial ad availability status is changed.
   *
   * @param - available is a boolean.
   *          True: means the interstitial ad is available and you can
   *              show the video by calling AdTimingInterstitialAd.showAd().
   *          False: means no ad are available
   */
  @Override
  public void onInterstitialAdAvailabilityChanged(boolean available) {
      // Change the interstitial ad state in app according to param available.
  }

  /**
   * Invoked when the Interstitial ad view has opened.
   * Your activity will lose focus.
   */
  @Override
  public void onInterstitialAdShowed(Scene scene) {
      // Do not perform heavy tasks till the ad is going to be closed.
  }

  /**
   * Invoked when the Interstitial ad is closed.
   * Your activity will regain focus.
   */
  @Override
  public void onInterstitialAdClosed(Scene scene) {
  }

  /**
   * Invoked when the user clicked on the Interstitial ad.
   */
  @Override
  public void onInterstitialAdClicked(Scene scene) {
  }

  /* Invoked when the call to load or show a Interstitial ad has failed
   * @param - error contains the reason for the failure:
   */
  @Override
  public void onInterstitialAdShowFailed(Scene scene, AdTimingError error) {
      // Interstitial ad show failed
   }
});

 Note:

  • The error parameter in onInterstitialAdShowFailed callback describes the cause of failure. Check the Error Code for more information and guidance on errors. 

  

Step 2. Serve Interstitial Ad

Ad Availability

AdTiming SDK automatic loads ads for you to cache the Interstitial Ads during application lifecycle if only SDK is integrated and initiated successfully. By correctly implementing the InterstitialAdListener , you will be notified about the ad availability through the onInterstitialAdAvailabilityChanged callback.

public void onInterstitialAdAvailabilityChanged(boolean available)

Another way to check if the ad is avalible is by calling the isReady function directly. 

public boolean isReady()

 Show Interstitial Ad

Once you receive the onInterstitialoAvailabilityChanged callback with available=TRUE, you can invoke the showAd() method to serve a Interstitial Ad to your users.

public void showAd(String sceneName)

Note:

  • Scene is a new concept being introduced for rewarded video and interstitial ads in Version 6.0. It is used to represent different ad scenarios in your app. You can use Scene-based frequency control, user rewards and data statistic etc. Go to AdTiming UI to create multiple Scenes in Settings of Placement.
  • Scene is optional,if you don't want to use it just ignore the sceneName parameter or use value "" as below.
//Use empty String as value if you don't need this functionality.
 AdTimingInterstitialAd.showAd("")
 //Or ignore it.
 AdTimingInterstitialAd.showAd()

But we do not recommend this, the Availability event only occurs when the ad availability changes, true or false, which does not necessarily mean it is the right time to serve ad. And showing ads in this callback unrestricted may result in frequent or even continuous ad pop-up, which will cause confusion for users and affect the experience. You should choose when your ads will show based on your application's ad plan.

//if you would like to show ad right after it's was loaded
public void onInterstitialAdAvailabilityChanged(boolean available) {
	if(available) {
		AdTimingInterstitialAd.showAd(sceneName)
   }
}

 Warning!

  • Showing ads in onInterstitialAdAvailabilityChanged callback can cause unforeseen ad pop-ups. You should not do this unless it is happened only in a specific scenario and the necessary restrictions have been imposed on your invoking to showAd.

We strongly recommend checking the ad's availability by isReady method before you show Interstitial Ad to your users, as shown in the following code:

//if you would like to show ad when it's required
if (AdTimingInterstitialAd.isReady()) {
AdTimingInterstitialAd.showAd(sceneName);
}

 Notes:

  • When you have successfully completed step 2, you will have shown a Interstitial Ad to your users. If you want to serve another Interstitial Ad, you just repeat step 2 to check ad availability and show a new Interstitial Ad.
  • If you mediate Admob ads,  you need to ensure that calls to the isReady method and show method are made in the main thread.

Capping and Pacing

You can use capping and pacing of scene to improve the user experience in your app by limiting the amount of ads served within a defined timeframe.  You can configure capping and pacing settings for selected scene in placement setting.

Important ! To ensure you don’t show the Rewarded Video button to prompt the user to watch an ad when the placement is capped, you must call the below method to verify if a specific placement has reached its ad limit.

AdTimingInterstitialAd.isSceneCapped(sceneName);

 

Done! 
You are now all set to deliver Interstitial ads in your app!

What's Next:

Follow our integration guides to integrate additional Interstitial Ad networks on our Mediation platform or configure additional Ad Units:

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.