Skip to content

Interstitial

Banners are small ads that when touched typically take the user to some form of fullscreen in-app browsing experience.

Interstitials, on the other hand, immediately present rich HTML5 experiences or web apps at natural app transition points such as launch, video pre-roll or game level load.

Preload vs. Interstitial

A preload ad will show up on app launch and an interstitial ad will show up between two activities.

Implementation for an interstitial ad is very similar to banner except that it is displayed fullscreen

To add an interstitial ad to your view it takes only a few lines of code:

  • Create an new instance of ADvantage instance in code (pass your license key, siteId and position to its constructor)
interstitial = new Advantage(this, "<LICENSE_KEY>", "<SITE_ID>", "<POSITION>");
banner.setSSLEnabled(true);

//Optionally add your custom loading animation
interstitial.setLoadingAnimationImageViewResourceId(R.drawable.loading_animation);
//Optionally set your custom close indicator drawable
interstitial.setCloseIndicator(R.drawable.closebutton);
//Optionally add your default background(as a view group, an example see above)
interstitial.setDefaultBackgroundViewGroup(db);

Note

  • You have to enable SSL before calling showInterstitial().
  • SSL enabled is required for every new license.
  • For customers where SSL has not yet been activated and you would like to switch, please contact us.

  • Add the EventHandler in order to handle ADvantage events (For more information please visit ADvantage events):
//Add the EventHandlers to handle ADvantage events
interstitial.setEventHandler(...);
  • Override onPause and onResume methods for better memory handling (For more information please visit ADvantage lifecycle):
// Important methods for the ADvantage lifecycle
@Override
protected void onPause() {
    super.onPause();

    if(interstitial!=null)
        interstitial.setActivityState(ActivityState.PAUSE);
}

@Override
protected void onResume() {
    super.onResume();

    if(interstitial!=null)
        interstitial.setActivityState(ActivityState.RESUME);
}
  • Load and show the interstitial ad via your ADvantage instances showInterstitial() method.
//Request ad
interstitial.showInterstitial();

Tip

The best place to do all this is in your Activity's onCreate() method.