HomeTutorialsHow to add interstitial ads in your Android App

How to add interstitial ads in your Android App

Find out the special power of including Google’s Interstitial Ads in your Android apps. This easy-to-follow guide will show you the right way to add these big, full-screen ads without messing up the fun your users are having. If you put these ads in just the right spots, they can get more clicks and interactions, which means more money for you.

What Are Interstitial Ads?

Interstitial Ads are full-screen ads that cover the entire interface of an Android app. Visually engaging and intriguing, they are typically displayed during natural transition points like the conclusion of a game level or while waiting for a new page load. These ads can effectively capture user attention and, if placed strategically, can highly increase your ad revenue.

Preliminary Steps: Integrating Google Mobile Ads SDK

Before embarking on the journey to add Interstitial Ads in your Android app, you need to integrate the Google Mobile Ads Software Development Kit (SDK) into your application.

Updating your Android Studio

Ensure you have the latest version of Android Studio. It’s essential to have updated tools for seamless integration.

Adding Google Play Services to your Project

Include the Google Play services package into your Project’s build.gradle file. This package is necessary because the Google Mobile Ads SDK is a part of Google Play services.

Adding Interstitial Ads in your Android App

With the prerequisites done, now here’s how you can add Interstitial Ads to your Android App.

Importing the Google Mobile Ads SDK

First, import the Google Mobile Ads SDK in the app-level build.gradle file. Once the Gradle project sync is successful, the SDK is ready to be used.

Adding Interstitial Ads elements

The next step involves creating the Interstitial Ad object, loading it with an ad, and then showing it when needed.

Another awesome tutorial:-  Google Login and Registration for Android App

How To Add Interstitial Ads In Your Android App

Below we have provided the source code for every important file that requires change or code addition.

First, you need to update your AndroidManifest.xml file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    <!-- The following lines are required for interstitial ads -->
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
        <!-- Make sure you replaced 'com.example.myapp' with your package name -->
        <activity android:name=".MainActivity">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />

Remember to replace "YOUR_ADMOB_APP_ID" with your actual AdMob App ID.

MainActivity.java file to create and load the ad. Here’s a basic example:

import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.InterstitialAd;
import com.google.android.gms.ads.MobileAds;

public class MainActivity extends AppCompatActivity {

    private InterstitialAd mInterstitialAd;

    protected void onCreate(Bundle savedInstanceState) {
        new OnInitializationCompleteListener() {
            public void onInitializationComplete(InitializationStatus initializationStatus) {

        AdRequest adRequest = new AdRequest.Builder().build();

        InterstitialAd.load(this,"YOUR_ADMOB_UNIT_ID", adRequest,
            new InterstitialAdLoadCallback() {
            public void onAdLoaded(@NonNull InterstitialAd interstitialAd) {
                mInterstitialAd = interstitialAd;

            public void onAdFailedToLoad(@NonNull LoadAdError loadAdError) {
                mInterstitialAd = null;
     public void mMyButton(View view) {

        if (mInterstitialAd.isLoaded()) {
        } else {
            startActivity(new Intent(this, MainActivity.class));


<?xml version="1.0" encoding="utf-8"?>

       android:text="Hello World!"
       app:layout_constraintTop_toTopOf="parent" />

       app:layout_constraintTop_toBottomOf="@+id/textView" />


Please adjust the method name in android:onClick to match your method in MainActivity.java. If you don’t have a method called mMyButton in your MainActivity file, you will get a runtime error when clicking the button. So, ensure that a suitable corresponding method exists!

Final Words

Adding Interstitial Ads to your Android app might be a good idea if you do it right. These ads are like full-page ads that pop up at certain times in your app. You need to know where to put these ads and when to show them to make your app better and to earn more money. This guide will help you learn how to add Interstitial Ads to your app in the best way.

Remember, it’s important to find a good balance. You want your ads to work well, but you don’t want to annoy your app users. Each app is unique, so you’ll need to take some time to think about the best way to use Interstitial Ads in your own app.

Aditya Singh
Aditya Singhhttps://optimizegoal.com
I'm a tech writer with over seven years of experience. I love to help people understand tech through my articles. I write about technology, mobiles, PCs, how-tos & guides, news and gadget reviews. I always stay updated with the latest in tech to give you the best info.

Related Articles