Static Interstitial

Interstitials are full-screen visuals that appear inside your application.

NEW: SDK version 7.0.0 supports zones. Please note, this release does not currently support cross promotion ad serving. To access our cross promotion features, please use SDK version 6.4.0

1. Override TMAdListener

Next, you will need to override the TMAdListener class to receive callbacks on interstitial adverts. Create a new file and implement it like so:

public class InterstitialListener extends TMAdListener {

    @Override
    public void didLoad() {
        // Ready to display the interstitial
    }

}

2. Load the interstitial

To load an interstitial, we recommend you load them once the Tapdaq SDK has initialised.

Go back to the TapdaqInitListener you created in the Quickstart guide, and add a call to load the interstitial, like so:

public class TapdaqInitListener extends TMInitListener {

    @Override
    public void didInitialise() {
        super.didInitialise();
        // Ads may now be requested
        Tapdaq.getInstance().loadInterstitial(<CurrentActivity>,  "my_interstitial_tag", new InterstitialListener());
    }

}

3. Display the interstitial

Update your InterstitialListener class you created earlier to display an interstitial:

public class InterstitialListener extends TMAdListener {

    @Override
    public void didLoad() {
        // Ready to display the interstitial
        Tapdaq.getInstance().showInterstitial(<CurrentActivity>, "my_interstitial_tag", new InterstitialListener());
    }
}

The code above is executed when the interstitial has successfully loaded. For a full list of interstitial listeners we support, see our Callbacks page.

It is also possible to check the interstitial is loaded before displaying it to the user, as shown below:

if (Tapdaq.getInstance().isInterstitialReady(<CurrentActivity>, "my_interstitial_tag")) {
    Tapdaq.getInstance().showInterstitial(<CurrentActivity>, "my_interstitial_tag", new InterstitialListener());
}

Build and run your application to test the advert displays correctly.

4. Load another interstitial on close

If you wish to load another interstitial after you have shown one, implement one of the following options:

A. Auto Reload all Ads

To auto reload all ads using the same placement tag set the global config before initialising, like so:

TapdaqConfig config = new TapdaqConfig();
config.setAutoReloadAds(true);

B. Implement Override

When creating an ad listener, create a custom constructor and store the placement tag, then override didClose() and call load for the same type and placement tag.

private class AdListener extends TMAdListener {
        private String mTag;

        AdListener(String tag) {
            mTag = tag;
        }

        @Override
        public void didClose() {
            Tapdaq.getInstance().loadInterstitial(<CurrentActivity>, mTag, this);
        }
    }

Need help?

If you are having any problems integrating, feel free to contact us on [email protected] and we will be more than happy to help.

What's next?

Now that you have successfully integrated an interstitial into your app, what would you like to do next?