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.


Interactive ad allows users to play H5 games and get all kinds of coupons advertisers offered.

Step 1. Set the Interactive Ad Listener

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

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

import com.adtiming.mediationsdk.interactive.AdTimingInteractiveAd;
import com.adtiming.mediationsdk.interactive.InteractiveAdListener;
import com.adtiming.mediationsdk.utils.error.AdTimingError;
import com.adtiming.mediationsdk.utils.model.Scene;
AdTimingInteractiveAd.setAdListener(new InteractiveAdListener() {

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

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

	 * Invoked when the interactive ad is to be closed.
	 * Your activity will regain focus.
	public void onInteractiveAdClosed(Scene scene) {

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


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


Step 2. Serve Interactive Ad

Ad Availability

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

public void onInteractiveAdAvailabilityChanged(boolean available)

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

public boolean isReady()

 Show Interactive Ad

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

public void showAd(String sceneName)

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 onInteractiveAdAvailabilityChanged(boolean available) {
	if(available) {


  • Showing ads in onInteractiveAdAvailabilityChanged 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 show ad only when it is required and checking the ad's availability by isReady() method before you show Interactive Ad to your users, as shown in the following code:

if (AdTimingInteractiveAd.isReady()) {


  • When you have successfully completed step 2, you will have shown a Interactive Ad to your users. If you want to serve another Interactive Ad, you just repeat step 2 to check ad availability and show a new Interactive 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.



You are now all set to deliver Interactive Ads in your app!

What's Next:

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


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



Please sign in to leave a comment.