Android Implementing Admob Interstitial Ad and Banner Ad in Android App

Android Implementing Admob Interstitial Ad and Banner Ad in Android App

Android Implementing Admob Interstitial Ad and Banner Ad in Android App In Previous posts I showed you how to implement Admob Banner Ad & Interstitial Ad to your Android application individually. Now i will show you How to implement both Admob Banner Ad and Interstitial Ad combined to your Android Application.

  • Create a new project or open your existing Android project in Android Studio 
  • Then ad below line of code in build.gradle inside your dependencies and sync project before proceeding further
compile ''
  • Now open your activity layout and add below lines of code. In my case I am pasting it in activity_main.xml file.

  • Now add below lines to your onCreate method in file.
AdView mAdView = (AdView) findViewById(;
AdRequest adRequest = new AdRequest.Builder().build();

// Prepare the Interstitial Ad
interstitial = new InterstitialAd(MainActivity.this);
// Insert the Ad Unit ID

// Prepare an Interstitial Ad Listener
interstitial.setAdListener(new AdListener() {
    public void onAdLoaded() {
        // Call displayInterstitial() function

Add below method to your file. If you don’t know exactly where to add code just paste above last curly bracket in the code or watch video embedded above.

public void displayInterstitial() {
// If Ads are loaded, show Interstitial else show nothing.
if (interstitial.isLoaded()) {;

Now add below to lines to your strings.xml 

<string name="banner_ad_unit_id">ca-app-pub-3940256099942544/6300978111</string>
<string name="admob_interstitial_id">ca-app-pub-3940256099942544/1033173712</string>

Note: Admob ad ids i am using here are test ad ids, you can get working ad ids from you Admob account.

  • Now run the application and test your self on AVD or Android device, you will get both Admob Banner ad & Admob Interstitial Ad
  • Link