AdMob is very familiar to all the android developers even for a beginner. AdMob gives you income through revenue generated by displaying Ads on Your App in two ways 1. Displaying Banner Ads & 2. Through Interstitial Ads 

In this article I will show you how to add Banner Ads in your Android Application assuming that you are using Android Studio for developing your app and your project is kept opened in it. Please watch video for better understanding.

 

  • Open your project in Android Studio
  • Add below line to your build.gradle dependencies

 

 

  • Now rebuild the project Build->Rebuild project or click on sync now
  • In project structure, Navigate to activity_main.xml and paste following code in your Layout

 

  • Open MainActivity.java add below lines inside onCreate method

 

 

  • Now open strings.xml  in values folder and below line into your strings.

 

 

  • To know how to get AdMob Banner ad ID Click Here

Banner AdMob ID used here is test ID which shows Test ads. You can use your real AdMob Banner Id when your are publishing your app to PlayStore.

Note: Using real Ad units while testing is against the AdMob poilicy.

Now we successfully implemented AdMob Banner Ad in your Android App. Run the app export as apk and test in your real device or on Emulator.

Download Source Code from below Link

 

[ihc-hide-content ihc_mb_type=”show” ihc_mb_who=”reg” ihc_mb_template=”1″ ]Download[/ihc-hide-content]