Migrate interstitial ads
Stay organized with collections
Save and categorize content based on your preferences.
This page covers the differences in loading and showing an interstitial ad
between the current and Next Gen Mobile Ads SDKs.
Load an ad
The following examples load an interstitial ad in the current and Next Gen
Mobile Ads SDKs:
Current |
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 onAdLoaded(@NonNull InterstitialAd ad) {
// Called when an ad has loaded.
ad.setFullScreenContentCallback(new FullScreenContentCallback() {});
interstitialAd = ad;
}
@Override
public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
// Called when ad fails to load.
}
}
);
|
Next Gen |
Kotlin
InterstitialAd.load(
AdRequest.Builder("AD_UNIT_ID").build(),
object : AdLoadCallback<InterstitialAd> {
override fun onAdLoaded(ad: InterstitialAd) {
// Called when an ad has loaded.
ad.adEventCallback =
object : InterstitialAdEventCallback {
}
interstitialAd = ad
}
override fun onAdFailedToLoad(loadAdError: LoadAdError) {
// Called when ad fails to load.
}
}
)
Java
InterstitialAd.load(
new AdRequest.Builder("AD_UNIT_ID").build(),
new AdLoadCallback<InterstitialAd>() {
@Override
public void onAdLoaded(@NonNull InterstitialAd ad) {
// Called when an ad has loaded.
ad.setAdEventCallback(new InterstitialAdEventCallback() {});
interstitialAd = ad;
}
@Override
public void onAdFailedToLoad(@NonNull LoadAdError adError) {
// Called when ad fails to load.
}
});
|
Show an ad
The following examples show an interstitial ad in the current and Next Gen
Mobile Ads SDKs:
Current |
Kotlin
interstitialAd?.show(this@InterstitialActivity)
Java
interstitialAd.show(this);
|
Next Gen |
Kotlin
interstitialAd?.show(this@InterstitialActivity)
Java
interstitialAd.show(this);
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-09-04 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["This page covers the differences in loading and showing an interstitial ad\nbetween the current and Next Gen Mobile Ads SDKs.\n\nLoad an ad\n\nThe following examples load an interstitial ad in the current and Next Gen\nMobile Ads SDKs:\n\n|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Current | Kotlin ```kotlin InterstitialAd.load( this@InterstitialActivity, \"\u003cvar class=\"readonly\" translate=\"no\"\u003eAD_UNIT_ID\u003c/var\u003e\", 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 ```java InterstitialAd.load( this, \"\u003cvar class=\"readonly\" translate=\"no\"\u003eAD_UNIT_ID\u003c/var\u003e\", new AdRequest.Builder().build(), new InterstitialAdLoadCallback() { @Override public void onAdLoaded(@NonNull InterstitialAd ad) { // Called when an ad has loaded. ad.setFullScreenContentCallback(new FullScreenContentCallback() {}); interstitialAd = ad; } @Override public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) { // Called when ad fails to load. } } ); ``` |\n| Next Gen | Kotlin ```kotlin InterstitialAd.load( AdRequest.Builder(\"\u003cvar class=\"readonly\" translate=\"no\"\u003eAD_UNIT_ID\u003c/var\u003e\").build(), object : AdLoadCallback\u003cInterstitialAd\u003e { override fun onAdLoaded(ad: InterstitialAd) { // Called when an ad has loaded. ad.adEventCallback = object : InterstitialAdEventCallback { } interstitialAd = ad } override fun onAdFailedToLoad(loadAdError: LoadAdError) { // Called when ad fails to load. } } ) ``` Java ```java InterstitialAd.load( new AdRequest.Builder(\"\u003cvar class=\"readonly\" translate=\"no\"\u003eAD_UNIT_ID\u003c/var\u003e\").build(), new AdLoadCallback\u003cInterstitialAd\u003e() { @Override public void onAdLoaded(@NonNull InterstitialAd ad) { // Called when an ad has loaded. ad.setAdEventCallback(new InterstitialAdEventCallback() {}); interstitialAd = ad; } @Override public void onAdFailedToLoad(@NonNull LoadAdError adError) { // Called when ad fails to load. } }); ``` |\n\nShow an ad\n\nThe following examples show an interstitial ad in the current and Next Gen\nMobile Ads SDKs:\n\n|----------|------------------------------------------------------------------------------------------------------------------|\n| Current | Kotlin ```kotlin interstitialAd?.show(this@InterstitialActivity) ``` Java ```java interstitialAd.show(this); ``` |\n| Next Gen | Kotlin ```kotlin interstitialAd?.show(this@InterstitialActivity) ``` Java ```java interstitialAd.show(this); ``` |"]]