Hide
DFP Android Guides

Interstitial Ad

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

Interstitials, on the other hand, immediately present rich HTML5 experiences or "web apps" at natural app transition points such as in between game levels. Web apps are in-app browsing experiences with a simple close button rather than any navigation bar—the content provides its own internal navigation scheme. Interstitial ads are typically more expensive and subject to impression constraints.

Create an interstitial ad unit in DFP

Create an ad unit in DFP to represent the interstitial ad unit. Interstitial ad units can be defined with one of the four common sizes, regardless of the actual screen size of individual devices. The SDK will handle rendering the creative correctly on screens which are of slightly different sizes.

  • Phones: 320x480 (portrait), 480x320 (landscape)
  • Tablets: 768x1024 (portrait), 1024x768 (landscape)

There is no need to define a separate ad unit for landscape mode. You can simply add the landscape size (e.g. 480x320 for smartphones) to line items targeting the interstitial ad unit and include a creative with the landscape size in addition to the regular portrait size.

InterstitialAd

The more heavyweight nature of InterstitialAd is reflected by its definition not as a View but rather an Object requiring more distinct instantiation, load and display steps.

Usage is nevertheless very similar to AdView:

  • Import com.google.android.gms.ads.*
  • Declare the instance
  • Create it, specifying an AdMob Ad Unit ID distinct from any used for banners

Once again, the easiest place to do this is somewhere in your app's Activity.

import com.google.android.gms.ads.*;

public class BannerExample extends Activity {

  private InterstitialAd interstitial;

  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    // Create the interstitial.
    interstitial = new InterstitialAd(this);
    interstitial.setAdUnitId(MY_AD_UNIT_ID);

    // Create ad request.
    AdRequest adRequest = new AdRequest.Builder().build();

    // Begin loading your interstitial.
    interstitial.loadAd(adRequest);

  }

  // Invoke displayInterstitial() when you are ready to display an interstitial.
  public void displayInterstitial() {
    if (interstitial.isLoaded()) {
      interstitial.show();
    }
  }
}

Here an interstitial is requested as soon as the activity starts. We will then call displayInterstitial() when we're ready to display the interstitial. This method calls show() to show the interstitial after checking isLoaded() to confirm the interstitial has finished loading.

Once shown, the interstitial takes over the screen until the user dismisses it, at which point control returns to your app.

Download the example project.