Advanced Usage- Interstitial Ads

View original article on our GitHub


Implement interstitial ads with objects for gaining more control over your ads, like using callbacks or using multiple ads with different properties.

To initialize an interstitial ad object, create a member variable in your activity as follows:

private StartAppAd startAppAd = new StartAppAd(this);

You can now use this object to perform the following operations:

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() BEFORE the methodsuper.onBackPressed():

public void onBackPressed() {

Showing Interstitials

Call showAd() in the appropriate place(s) in the activity where you would like to show the Ad:

startAppAd.showAd(); // show the ad

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

public void btnOpenActivity (View view){
    Intent nextActivity = new Intent(this, NextActivity.class);
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request