Follow

Interstitial Ads

View original article on our GitHub.

Interstitial Ads are displayed before or after a certain content page or action, such as upon entering a stage, between stages, while waiting for an action, upon exiting the application and more.

Showing Exit Ads

To show an ad upon exiting your application when pressing the 'Back' button, override theonBackPressed() method and add the method StartAppAd.onBackPressed(this) BEFORE the method super.onBackPressed() (this is the activity/application context):

@Override
public void onBackPressed() {
    StartAppAd.onBackPressed(this);
    super.onBackPressed();
}

Showing Interstitials

Call StartAppAd.showAd(this) in the appropriate place(s) in the activity where you would like to show the Ad. The showAd method returns true in case the ad was displayed successfully, or false if not (for example, if an ad isn't ready yet).

The following is an example of showing an Interstitial Ad between Activities:

public void btnOpenActivity (View view){
    Intent nextActivity = new Intent(this, NextActivity.class);
    startActivity(nextActivity);
    StartAppAd.showAd(this);
}

IMPORTANT: Loading an ad might take a few seconds. In case you call showAd() while the ad hasn't been successfully loaded yet, nothing will be displayed. If you want to show an ad when your application is launched, use our "Splash Ad". You can also implement your interstitial ad as an object and use the "onReceiveAd" callback which is triggered when an ad was loaded and ready to use. See "Interstitial Ads" under the "Advanced Usage" section.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

  • Avatar
    Erick Atoche Lugo

    Hi guys. I have a problem. I'm using interstitial ads on my Android app, I don't want to display videos so I added the ad type parameter OFFERWALL in loadAd() method and overrided onSaveInstanceState() and onRestoreInstanceState() methods following the documentation, but it's still displaying videos sometimes. How can I avoid this? Thanks in advance

  • Avatar
    Jemishkumar Bhimjibhai Lakhani

    Hi Guys,
    I am getting full screen interstitial on my homescreen even if app is closed. after bit in sleep mode? any idea how to stop ad to appearing on homescreen.