Interstitials/FullScreen for Static or Video ads

Interstitial is an ad shown in fullscreen, with the option to close it.

If you want to request an interstitial and show it as soon as possible, you can use the setAutoShowWhenReaady method:

tappxInterstitial.setAutoShowWhenReady(true);

Example:

public class InterstitialActivity extends Activity {

    TappxInterstitial tappxInterstitial;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        tappxInterstitial = new TappxInterstitial(InterstitialActivity.this, "**YOUR-APP-KEY**");
        tappxInterstitial.setAutoShowWhenReady(true);
        tappxInterstitial.loadAd();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (tappxInterstitial != null) tappxInterstitial.destroy();
    }
}

If you want to have more control, you can use the following three options: loadAd, isReady and show.

loadAd is the request to get the ad and load all the information so you can show the ad.

tappxInterstitial.loadAd();

isReady allows you to check if the ad is ready to be shown. You will receive a “true” if the ad is ready and a “false” if not.

tappxInterstitial.isReady();

show allows you to display the interstitial ad that has loaded previously.

tappxInterstitial.show();

These three options are useful in games for example, if you want to load the ad while the user is playing and show it immediately when the user finishes the play.

Listeners:


You can add listener events into the Interstitial to be notified when a specific event happens in the ad. To listen to the events we have to set a listener with the interstitial.setListener() method:

tappxInterstitial.setListener(new TappxInterstitialListener() {
    @Override
    public void onInterstitialLoaded(TappxInterstitial tappxInterstitial) {
        Log.v("Tappx", "Tappx: onInterstitialLoaded");
    }

    @Override
    public void onInterstitialLoadFailed(TappxInterstitial tappxInterstitial, TappxAdError tappxAdError) {
        Log.v("Tappx", "Tappx: onInterstitialLoadFailed");
    }

    @Override
    public void onInterstitialShown(TappxInterstitial tappxInterstitial) {
        Log.v("Tappx", "Tappx: onInterstitialShown");
    }

    @Override
    public void onInterstitialClicked(TappxInterstitial tappxInterstitial) {
        Log.v("Tappx", "Tappx: onInterstitialClicked");
    }

    @Override
    public void onInterstitialDismissed(TappxInterstitial tappxInterstitial) {
        Log.v("Tappx", "Tappx: onInterstitialDismissed");
    }
});

Tappx © 2020