Skip to content

Interstitial

Integration

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)
private var interstitial: Advantage? = null
...
interstitial = Advantage(this, "<LICENSE_KEY>", "<SITE_ID>", "<POSITION>")
interstitial?.sslEnabled = 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)
private Advantage interstitial;
...
interstitial = new Advantage(this, "<LICENSE_KEY>", "<SITE_ID>", "<POSITION>");
interstitial.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 fun onPause() {
    super.onPause()
    interstitial?.setActivityState(Advantage.ActivityState.PAUSE)
}

override fun onResume() {
    super.onResume()
    interstitial?.setActivityState(Advantage.ActivityState.RESUME)
}
// 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();
//Request ad
interstitial.showInterstitial();

Tip

The best place to do all this is in the Activity's onCreate() method or in the Fragment's onViewCreated() method.

We strongly recommend the use of a Consent Management Platform (CMP) compliant with TCF 2.0 if your audience on your website/app, in whole or in part, is located within the EU.

Click here for instructions on how to hand over TCF 2.0 Consent to ADvantage.