Saturday, August 26, 2017

Interstitial Ads for Android



Today We are going to learn how to set interstitial Ads for android.
Our Steps of work describe below.


Creating An Android Project

Open your android studio and under File>New>New Project and name your Interstitial Demo. Press next and keep as it is and press next select Empty Activity. Then press next and then finish.


Editing build.gradle 

Now we need to edit build.gradle file. 
Open build.gradle file and under Dependencies add this simple code and press sync now.


Editing AndroidManifest.xml 

Now Open AndroidManifest.xml file do some coding....
First add two permission 


Then Under Application add these meta-data

Under Application also add these activity code

That's enough for AndroidManifest.xml

Editing string.xml

Under res>values we have string.xml file. Our string.xml file should be look like

Editing activity_main.xml

Under res>layout we have activity_main.xml file. 
Our activity_main.xml file should look like

Editing MainActivity.java

Under java>com.example.sagorsarker.interstitialdemo we have MainActivity.java class
After editing our MainActivity.java will looks like as below


After doing all of above editing press run button. when your application open on android emulator then just press the 'show ads' button. Your interstitial ads will appear in front of your sight. 








No comments:

Post a Comment

Recent Post