Google AdMob is one of the best monetization platforms for Android developers. Among all available ad formats, Interstitial Ads provide high-earning potential because they cover the full screen and appear at logical breaks in the app flow — such as before loading a new screen or after completing a task.
| image by: openreplay |
In this post, you will learn how to integrate AdMob Interstitial Ads in Android Studio using Kotlin, step by step. This guide works for 2025, uses the latest SDK guidelines, and includes complete working code.
✅ What is an Interstitial Ad?
An interstitial ad is a full-screen ad that appears at natural transition points in your app, such as:
-
Between activities
-
After a button click
-
Before loading content
-
After completing a game level
They offer higher CPM and impressions compared to banner ads.
Step 1: Add AdMob to Your App
1. Add Google Mobile Ads SDK
Open your project-level build.gradle and add:
Now in app-level build.gradle:
Sync the project.
Step 2: Add App ID in AndroidManifest.xml
Add YOUR APP ID inside <application> tag:
Step 3: Add Test Ad Unit ID
Use AdMob test ID (Recommended during development):
Step 4: Load Interstitial Ad in Kotlin
Create a variable(Top of onCreate/onViewCreated):
Load the Ad
📌 Step 6: Add Callback Events
To handle ad close, dismiss, fail, impression etc.:
private fun showInterstitialOrRun(action: () -> Unit) {
val ad = interstitialAd
if (ad != null) {
ad.fullScreenContentCallback = object : FullScreenContentCallback() {
override fun onAdDismissedFullScreenContent() {
interstitialAd = null
loadInterstitial() // reload for next time
action() // run your function
}
override fun onAdFailedToShowFullScreenContent(error: AdError) {
interstitialAd = null
action()
}
}
ad.show(requireActivity())
} else {
action() // fallback directly
}
}
private fun showInterstitialOrRun(action: () -> Unit) {
val ad = interstitialAd
if (ad != null) {
ad.fullScreenContentCallback = object : FullScreenContentCallback() {
override fun onAdDismissedFullScreenContent() {
interstitialAd = null
loadInterstitial() // reload for next time
action() // run your function
}
override fun onAdFailedToShowFullScreenContent(error: AdError) {
interstitialAd = null
action()
}
}
ad.show(requireActivity())
} else {
action() // fallback directly
}
}
Step 5: Show the Interstitial Ad
Call this function when user performs an action (e.g., button click):
Best Practices for Interstitial Ads
✔ Show only at natural app breaks
✔ Do not spam the user
✔ Do not mix too many ads
✔ Always preload the next ad
✔ Use test ads during development
✔ Comply with Google AdMob policies
Conclusion
You have successfully integrated AdMob Interstitial Ads in Android Studio using Kotlin.
This is the recommended modern way, fully compatible with the latest Google Play Services updates.
No comments:
Post a Comment