Integrating Admob Advertisements in Android App

Google admob ads can be placed in your app to earn money through advertising. Use this feature to earn money through freely distributed apps. Step by step procedure to do this is as follows.

Step 1

Login to Admob Account and complete following procedures  :

  1. Monetize your app.
  2. Connect your app to Firebase.
  3. Create new add banner.
  4. Get app id and ad unit id.
  5. Use app id and ad unit id in following steps.
  6. Download google-services.jason file for the app from firebase console and save it into app folder of your project.
Admob Instructions App ID

Admob Instructions App ID

Google Services Jason Location

Google Services Jason Location

Step 2

Add classpath ‘’ to your projects gradle file as follows.

Step 3

Add following lines to your app’s gradle file.

compile ‘’
compile ‘’

Step 4

Add following line at the end of app’s gradle file as shown above.

apply plugin: ‘’

Step 5

Add following lines to your app’s manifest file if not already done so.

<uses-permission android:name=”android.permission.INTERNET”/>
<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE” />

Step 6

Add add banner to the layout file of the activity in which you want to add the ad banner. Replace ad-unit-id with actual ad unit id for the banner ad you created in admob console.

ads:adUnitId=”add-unit-id” <– Replace this

Step 7

Add following code to activities onCreate method after setContentView method call.

// Google Advertisement Banner
MobileAds.initialize(getApplicationContext(), “myappid”);
AdView mAdView = (AdView) findViewById(;
AdRequest adRequest = new AdRequest.Builder().build();

Replace myappid  with appid with actual app id you created in step 1.  It is in following format.


Thats it..!!

Deploy your app on play store and start earning money..!!