Migrate interstitial ads




This page covers the differences in loading and showing an interstitial ad between Google Mobile Ads SDK (Legacy) and GMA Next-Gen SDK.

Load an ad

The following examples load an interstitial ad:

Google Mobile Ads SDK (Legacy)

Kotlin

InterstitialAd.load(
  this@InterstitialActivity,
  "AD_UNIT_ID",
  AdRequest.Builder().build(),
  object : InterstitialAdLoadCallback() {
    override fun onAdLoaded(ad: InterstitialAd) {
      // Called when an ad has loaded.
      ad.fullScreenContentCallback =
        object : FullScreenContentCallback() {
        }
      interstitialAd = ad
    }

    override fun onAdFailedToLoad(loadAdError: LoadAdError) {
      // Called when ad fails to load.
    }
  }
)

Java

InterstitialAd.load(
  this,
  "AD_UNIT_ID",
  new AdRequest.Builder().build(),
  new InterstitialAdLoadCallback() {
    @Override
    public void