How to add Admob Interstitial Ad in Android Studio - Google Ad SDK 20.5.0

In this article we will learn how to integrate Google Admob Interstitial Ad in our android app, so before going to the coding part we will first learn some basics and features of Interstitial

Interstitial Ads:

Interstitial ads is a full screen ad which cover the entire screen of the user ,it is usually show when a certain task is completed such as when user completed the level of the game,or when user wanted to download the image from the app ,or transition

Feature of Interstitial Ads:

A.  Show both text ads,video ads , image ads
 
B. Support frequency cap means you can decide how many ads are show to the user daily or hourly
 
C. User can interact with the ad as it also contains playable ads 

D. The eCPM is hight as compare to Banner Ads , so it leads to more revenue 

E. support both Mobile phones and Tablets 

F. fill rate is maximum

 So let's implement a simple Admob Interstitial Ad in our android app.


Step 1: Create a new Project


  1. Open Your Android Studio Click on "Start a new Android Studio project

  2. Choose "Empty Activity" from the project template window and click Next

  3. Enter the App Name,Package name, save location, language(Java/Kotlin ,we use Java for this tutorial ) and minimum SDK(we are using API 29: Android 4.4 (KitKat) )

  4. Next click on Finish button after filling the above details

  5. Now wait for the project to finish building.

Step 2: Adding the Mobile Ads SDK


To show the ads in our app we have to first implement the Admob sdk in our app ,to do so

Go to Gradle Scripts->build.gradle (Module: app) section and import below dependencies and click the "sync Now" show at the top


In your project-level build.gradle file, include in both your buildscript and allprojects sections:

buildscript {
    repositories
{
        google
()
        mavenCentral
()
   
}
}

allprojects
{
    repositories
{
        google
()
        mavenCentral
()
   
}
}

Step 3: Modify AndroidManifest.xml


<manifest>
<uses-permission android:name= "android.permission.INTERNET"/>
</manifest>




Now we add add our AdMob AppId to your in the  Android Mainfest  file by adding the <meta-data> tag inside the <application> tag





Step 4: Create activity_main.xml

complete code of activity_main.xml is show below:







Step 5: Create second_activity.xml

complete code of activity_second.xml is show below:

Uploading: 40020 of 40020 bytes uploaded.




Step 6: MainActivity.java file


The completed code of MainActivity.java is shown below:






Step 7: SecondActivity.java file

The completed code of SecondActivity.java is shown below:










Comments

Popular posts from this blog

Privacy Policy Hindi Calendar 2025 - पंचांग