AdMob is a multi platform mobile ad network that allows you to monetize your android app. By integrating AdMob you can start earning right away. It is very useful particularly when you are publishing a free app and want to earn some money from it.

Integrating AdMob is such an easy task that it takes not more than 5mins. In this article we’ll build a simple app with two screen to show the different types of ads that AdMob supports.

android-integrating-admob-ad-platform-earn-money

1. Type of Ads – Banner and Interstitial

AdMob currently support two kinds of ad units. One is Banner ad which occupies a portion of the screen. Other is Interstitial ad which occupies device full screen. Interstitial completely blocks your app UI and places the ad on top it.

android-integrating-admob-banner-interstitial

2. Creating Ad Units

1. Sign into your AdMob account.

2. Click on Monetize tab.

3. Select or Create the app and choose the platform.

4. Select the ad format either Banner or Interstitial and give the ad unit a name.

5. Once the ad unit is created, you can notice the Ad unit ID on the dashboard. An example of ad unit id look like ca-app-pub-066457076332243242/3326342124

Create as many ad units required for your app.

android-admob-creating-ad-unit

Create two ad units, one for banner and other for interstitial as we need to use the ad unit IDs in the next section.

3. Creating New Project

1. Create a new project in Android Studio from File ⇒ New Project. When it prompts you to select the default activity, select Empty Activity and proceed.

2. Open build.gradle and add play services dependency as AdMob requires it.

compile ‘com.google.android.gms:play-services-ads:8.4.0’

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'

    compile 'com.google.android.gms:play-services-ads:8.4.0'
}

3. Add the Ad unit IDs to your strings.xml. Open strings.xml located under res ⇒ values and add the ad units of both Banner and Interstitial.

<resources>
    <string name="app_name">AdMob</string>
    <string name="title_activity_second_activiy">Interstitial</string>
    <string name="msg_welcome">Welcome to Admob. Click on the below button to launch the Interstitial ad.</string>
    <string name="btn_fullscreen_ad">Show Fullscreen Ad</string>

    <!-- AdMob ad unit IDs -->
    <string name="banner_home_footer">ca-app-pub-0664573200302260/332653322424</string>
    <string name="interstitial_full_screen">ca-app-pub-066498932138293260/1769900428</string>

</resources>

4. Open AndroidManifest.xml and add the below mentioned permissions and other properties.

> Add INTERNET & ACCESS_NETWORK_STATE permissions.

> Add google play services version meta-data.

> Add the AdActivity adding configChanges and theme attributes.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="info.androidhive.admob">

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!--Include the AdActivity configChanges and theme. -->
        <activity
            android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            android:theme="@android:style/Theme.Translucent" />
    </application>

</manifest>

3.1 Adding Banner Ad

Banner ads occupies only a portion of the screen. I am adding a banner ad in my main activity aligning to bottom of the screen. In order to add the banner ad, you need to add com.google.android.gms.ads.AdView element to your xml layout.

<com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_home_footer">
    </com.google.android.gms.ads.AdView>

5. Open the layout file of your main activity (activity_main.xml) and add the AdView widget. I am also adding a button to launch another in which we’ll try Interstitial ad.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="info.androidhive.admob.MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/msg_welcome" />

    <Button android:id="@+id/btn_fullscreen_ad"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:text="@string/btn_fullscreen_ad"/>

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_alignParentBottom="true"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_home_footer">
    </com.google.android.gms.ads.AdView>
</RelativeLayout>

6. Open MainActivity.java and modify the code as shown.

> Create an instance of AdRequest and load the ad into AdView.

> Ad the AdView life cycle methods in onResume(), onPause() and in onDestroy() methods.

package info.androidhive.admob;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;

public class MainActivity extends AppCompatActivity {

    private AdView mAdView;
    private Button btnFullscreenAd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        mAdView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder()
                .build();
        mAdView.loadAd(adRequest);

        btnFullscreenAd = (Button) findViewById(R.id.btn_fullscreen_ad);
        btnFullscreenAd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(MainActivity.this, SecondActivity.class));
            }
        });
    }

    @Override
    public void onPause() {
        if (mAdView != null) {
            mAdView.pause();
        }
        super.onPause();
    }

    @Override
    public void onResume() {
        super.onResume();
        if (mAdView != null) {
            mAdView.resume();
        }
    }

    @Override
    public void onDestroy() {
        if (mAdView != null) {
            mAdView.destroy();
        }
        super.onDestroy();
    }
}

Now if you run the app, you should see a banner ad at the bottom of your screen.

android-displaying-admob-banner-ad

3.2 Adding Interstitial Ad (Fullscreen Ad)

Interstitial ads occupies full screen of the app. Adding interstitial ad doesn’t require an AdView element to be added in the xml layout. Rather we load the ad programatically from the activity. Normally these ads will be populated when user is moving between activities or moving to next level when playing a game.

We’ll test this ad by creating a second activity and popup the full screen ad when the second activity is launched.

7. Create an activity named SecondActivity.java by right clicking on package New ⇒ Activity ⇒ Empty Activity.

package info.androidhive.admob;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.InterstitialAd;

public class SecondActivity extends AppCompatActivity {

    private String TAG = SecondActivity.class.getSimpleName();
    InterstitialAd mInterstitialAd;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);

        mInterstitialAd = new InterstitialAd(this);

        // set the ad unit ID
        mInterstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen));

        AdRequest adRequest = new AdRequest.Builder()
                .build();

        // Load ads into Interstitial Ads
        mInterstitialAd.loadAd(adRequest);

        mInterstitialAd.setAdListener(new AdListener() {
            public void onAdLoaded() {
                showInterstitial();
            }
        });
    }

    private void showInterstitial() {
        if (mInterstitialAd.isLoaded()) {
            mInterstitialAd.show();
        }
    }

}

Now if you run the app, you can see the interstitial ad when the second activity is launched.

android-displaying-admob-interstitial-ad

3.3 Enabling Test Ads

As per AdMob Policies you are not allowed to click on your own live ads. In order to protect your AdMob account from getting suspended, use test ads during development as you might click the ads accidentally.

When you run the project, if you monitor the LogCat, you can find a similar line Use AdRequest.Builder.addTestDevice(“C04B1BFFB0774708339BC273F8A43708”) to get test ads on this device. Copy the device id and add it to AdRequest as shown below. Note that this ID varies from device to device, By doing this, the test ads will be loaded instead of live ads.

In production you need to make sure that you removed addTestDevice() methods in order to render the live ads and start monetization.

AdRequest adRequest = new AdRequest.Builder()
                .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
                // Check the LogCat to get your test device ID
                .addTestDevice("C04B1BFFB0774708339BC273F8A43708")
                .build();

3.4 Ad View Listeners

Ad listeners are very useful to perform the next action when ad is closed. Below are the ad listeners can be used to notify your app when ad changes its state.

mAdView.setAdListener(new AdListener() {
            @Override
            public void onAdLoaded() {
                Toast.makeText(getApplicationContext(), "Ad is loaded!", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onAdClosed() {
                Toast.makeText(getApplicationContext(), "Ad is closed!", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onAdFailedToLoad(int errorCode) {
                Toast.makeText(getApplicationContext(), "Ad failed to load! error code: " + errorCode, Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onAdLeftApplication() {
                Toast.makeText(getApplicationContext(), "Ad left application!", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onAdOpened() {
                Toast.makeText(getApplicationContext(), "Ad is opened!", Toast.LENGTH_SHORT).show();
            }
        });

Download the demo app and start playing until you get enough knowledge about AdMob.

Ravi is hardcore Android programmer and Android programming has been his passion since he compiled his first hello-world program. Solving real problems of Android developers through tutorials has always been interesting part for him.
  • Thirumaran

    plzzz xplain how to get money?????????????????????

    • Place these ads in your apps. You will get money when somebody clicks on the ad.

      • Thirumaran

        thank u so much………

        • bhavik gandhi

          Hello, I want to Implement Video Ads
          So please any other that display video ads and alternative of admob

      • Eyal Engel

        Can I put an ad of my own and get money for it? or do I need to close a deal with a real company who wants to advertise on my app?
        e.g. Can I put an ad that says: “click me”, and get money if someone clicks it (although it will do nothing special…?

        Thanks!

        • No you can’t do that using AdMob. What you are looking for BuySellAds (It supports only web). May be you can check any providers who is doing this for android apps.

  • Thirumaran

    plzzzz give some example for android Responsive preview

  • Trey Rosius

    is it advisable to place such ads on a social network?? Just wondering

  • Renitto Jose

    Thanks Ravi . it will be helpful if you could provide video regarding registering on admob and getting real ids.

    • Its nothing complex. It takes only two steps which I shown it in the image. And all the ads are real ads. We’ll make them as test ads in the code.

      • Renitto Jose

        Thank you 🙂 . But what about things like attaching my account details / paypal account with admob (i don’t know exactly this is the right way or not)

        • All the details can be managed from AdMob admin panel. Just login once and check

          • anirban mandal

            reply

  • ahmed bik

    Hi
    thank you for this explain

    I have problem with this code
    see

    Ads: Ad is not visible. Not refreshing ad.
    Ads: Scheduling ad refresh 60000 milliseconds from now.

    what I can do ?

  • Copy right

    My Friend,
    I am inform you your post is – http://www.androidhive.info/2012/08/android-session-management-using-shared-preferences/

    is lost of copy found in google search – check this copy content link..
    http://www.java4you.in/2014/08/android-user-session-management-using.html

    Request to remove this post copy right post.

    • Thank You, I contacted them.

      • anirban mandal

        Hello !!

        • anirban mandal

          hello..hi

      • anirban mandal

        Hi plss dont mind if i ask you a questn Ravi Tamanda do you use a commenting 3rd party or this comment section is made by your own??? Plss let me know if your using a 3rd party..then i will also use it..thnxx in advance..

      • SelvaGanesh

        hai ravi could u teach me how to create swipeable tabs using JSON valley.

  • yo_asakura

    I think the stuff in the AndroidManifest are not necessary. They are required if you use Eclipse, but in Android Studio they are not needed. Proof: https://developers.google.com/admob/android/quick-start

    • Yeah, I kept the in mind about both the cases.

  • ARASHI Funsho

    Thanks for this post…… came up exactly when I needed it the most. Other posts were kinda outdated……..

  • Žilvinas

    How to insert admob ad in to listview?

    • I think it’s against AdMob policies to place it listview.

  • Abhilash

    Hi, i am displaying fragment through Activity…So, How can i place Adview in fragment.?

    if i add adview in Activity_main.xml .. its showing but not floating and clickable.

  • Gamis

    Wouu thank you for the example…. actually i begin work with Ads, but i have a question…

    I need implement a VIDEO ad.. name PRE-ROLL i search and google work with IMA:

    https://developers.google.com/interactive-media-ads/docs/sdks/android/quickstart

    AdMob have the same tecnologie?

  • Ramya

    We have the same app for Android and IOS. can we use the same adUnit ID for both?

    • I don’t think you can use same Unit ID for both. When we creating the app, it is asking to select the platform (check the screenshot) where we are defining the platform.

  • great tutorial. keep sharing

  • Chirag thaker

    Hello Ravi, From many times i am folowing your tutorials and its very helpful, one problem i am suffering from 2-3 days is that OutOfMemory error in loading images. i have image automatic slider in my app. so when i start running on mobile , it throws error of outofmemoryerror in logcat . please help me to solve.

    I did not know how to set background of layout or load image from Bitmap drawable so i directly load in tag.

    for background

    Thanks in advance @ravi8x:disqus

    • Don’t keep the image directly on LinearLayout. Compress the image as much as possible before adding to project. Use https://tinypng.com/ to compress the image.

      Also while setting the background, set the image programatically instead of setting in xml. Use the below function to compress the image and set as background to linearlayout.

      Try the below line once
      getWindow().setBackgroundDrawableResource(R.drawable.bg_view_full);

  • Nithya Sri

    can anyone help me on gradle sync failed:Gradle DSL method not found: ‘compile()’

    Consult IDE log for more details (Help | Show Log)

  • haseena shaik

    Hi,
    I have vertically scrollable edittext inside scrollview .
    when enter key pressed layout auto scrolling. could you please help.
    thanks in advance @ravi8x:disqus

  • shivam pandey

    Hi Ravi adMob is great, No doubt. but it is not showing any impression on slideMe market devices and not even Analytics are working there. Could you suggest me something for this context.

  • Viet Nam

    HI Thanks
    very useful
    Sorry please for me ask
    I viewed all your post on android but not view post toturial Service of android.You can write post service Android ?
    If can i very grateful you because service i see it very important in some app good.Thanks

  • Deep Shikha

    Hi Ravi,
    Hope you are doing well. I have followed you on numerous topics for learning android app development. Please advise if you also take classes or guide.

    Eagerly waiting for your advise.

    Thanks,

    Regards,
    Deep Shikha

  • Hiep

    Hi Ravi,

    I enjoyed your tutorials. I hope you do a tutorial on integrating Native ads admob or facebook into RecyclerView .

    Thanks,

    Regards

  • Sami

    Hi Ravi, Im totally new to this stuff so sorry for noob questions.

    I am using Navigation-Drawer in my application(i have followed your material desing tutorials). So I have created single activity with navigation_drawer layout. I am using fragments to change main content area data whenever user chooses a menu option from navigation drawer menu.Now my problem is that I want to show admob ad on every screen and when opening the navigation drawer the ad will be under the navigation menu.

    My question is: is there any conflict or contrast with the AdMob Policies ?

  • rekian

    brother, why your web deindexed on google search? only 1 page being indexed

    • Hi rekian

      Thanks for letting me know. I am checking it right away.

  • Ramesh Bista

    Hello ravi, I have a small issue.I don’t think how logical it is. What if I wished to add only desired app from playstore. For example I just want to display facebook and twitter add randomly.How can I do that if it is possible to do?

  • Manish Butola

    Great Tutorial !

  • Rahul

    Hello Ravi bhai, great tutorial. Can you please tell me how do you created that video.Please.

    • I recored the video on my mobile and used Camtasia studio to edit the video.

      • Rahul

        Thank you Ravi bhai for your reply.

  • Parth Patel

    without publishing app…i can earn through adMob??

    • No, you can’t

    • Otman Soulimani

      you can if you did publish app in other markets

  • ARASHI Funsho

    Thanks, was able to adapt the code here to display banner and interstitial ads in fragments 😉 cheers bro

  • Amarbir Singh

    getting error while adding dependency to gradle. Error-> failed to resolve:com.google.android.gms:play-services-ads:8.4.0 and compile&target sdk-23, min-14. Help me on this ravi!!

    • Amigo Madiq

      download the m2 repository manually or let the Gradle sync so it would be able to add the dependancy.

  • hari

    Hai Ravi sir

    I have ad mob using ad created. in that case i have getting some blank page kindly help me how to resolved in this problem

    i have attached the link below

    http://stackoverflow.com/questions/36835494/admob-is-working-but-getting-blank-page

  • Qasim

    thanks man .
    helped alot.

  • Bojan Ursus

    thanks!

  • Dhaval Shingala

    thanks bro…

  • SM Mizan

    i face a problem console error :- Failed to load ad: 0
    how to solve this problem.

    • Ahmed Buchery

      I’m facing the same issue, my app is play store but with no ads.

      While in development I’ve added the .addTestDevices but on production I removed it and no one that downloaded the app sees ads.

      I have create a new ad-unit with no luck

      • FaisalHyder

        As salam o alaikum, issue is that you guys might be taking app id from app-management page on admob account, don’t take it from there take app-pub id from Monetize tab and under all apps check the ad unit you made use this id in app. hope this helps.!!

  • Syed Farrukh

    Hi Ravi …
    Thanks for the tutorial everything is working fine…. can you please guide me how to integrate Video ads in android studio and one question more how to generate video Ad id in admob …. Thank you in advance dear

    • brother as far as i know, look at the image where Ravi bhai showed admob screen shots, there is also video available, i think same method will work for image/Text and video ads in Interstitial Ad.

  • jerom

    please add Admob native ads example, these tutorials are the best, easy and simple , with good explanation

  • mohammad

    hello ravi , how can I put my own ads in a banner like that , but not by google ads, like my own ads banner’? thank you brother

    • For that you don’t need AdMob, you can just show Fragment Dialog with fullscreen ImageView in it. But why do you want to do that?

    • Chris Harris

      Did you implement that?

  • shankze

    This works great on the emulator. When I run it on my phone, I don’t see the ad. What could be the problem?

    • raghavendra

      Add this line in manifest.xml

  • Arun Joy

    can you give example of new ad feature like native

  • David Kimigho

    Nice tutorial Sir. Im a big fan of your,blog. Do you mind giving a tutorial on adding an add mob banner after 5 items in a listview or Recyclerview, something related to facebook feeds

  • Raja Mohamed

    how do get the live add eventhough i removed addTestDevice method i did not get live add why?

  • Raja Mohamed

    i got test add eventhough i removed addTestDevice method i did not get live add why?

  • Raja Mohamed

    anyone will quickly response

  • Parmesh Bhande

    only one add is showing how to display different-different adds, i mean live ads. can we manage through AdMob site which adds should be display in app ?

  • Tushar takodra

    hii ravi I am using your code to integrate adMob in my app. But it only display InterstitialAd not show the video ads. i set the only video in google admob account.

    • I guess, google decides which ad to show depending on the user.

  • Amigo Madiq

    Ravi maybe it’s late to congratulate you but you deserve that. thanks bro 🤓

  • Raj Jat

    Hi Ravi, I include your code of admob but cant load and Show Adsruntime in my app
    all procedur completed……………help

  • Sateesh Kumar Reddy Nandyala

    Hi Ravi
    I want to display interstitial ad before the activity launch. Like once ads displayed then only i want to show the my activity. If possible could you please share your inputs.

  • Viru Kumar

    Hello Ravi thanks for this its very easy code

  • Viru Kumar

    Ravi plz give me some code about “Android GPS Tracking with Google map”

  • amine dexter

    hello every body,
    it’s been 24 hours i have this problem please any one could help
    the error is : Error inflating class com.google.ads.AdView

    • Rishab Surana

      I wonder you are working in eclipse
      if so then i recommend you to switch to Android Studio coz i also had this problem and couldn’t find any solution for this but if you are working in Studio then there should’t be any problem if you have included the google play services in the app
      But if u get any solution to this don’t forget to share it
      Hope it helps

  • Mh Emon

    Hello Ravi,

    Banner Ad is not shown in my app. but full screen ad shown perfectly.. i am fully Follow your tutorial.. i also download your apk. bt your demo app also Unable to load banner ad.
    plz help me out..

    • Farhad Mammadli

      truncate your hosts file

      • Mh Emon

        I already solve this! Thnks..

        • Manik Mittal

          Please tell how u solve this

      • giantmalik

        how to truncate?

  • Farhad Mammadli

    hi, it is disallowed interstitial implementation, isn’t it ?
    https://storage.googleapis.com/support-kms-prod/CAD1F8260F59329A91195F4D196DD152BD88

  • devansh

    Can someone create this app to show ad for me. I will provide all the details necessary.

    • Chris Harris

      where is your app?

  • Sachin Vaghela

    Hi Ravi,
    Your Code is very helpful to us. but my question is i saw some different steps to Integration Google Admob in application here the link is : https://firebase.google.com/docs/admob/android/quick-start
    I implement your code and its working very well but i want to know which is the right way to integration?

  • Nahidul Islam Nahid

    In my app i have a banner ad also i have given ad refresh after 120 seconds. It seems to me that the estimated earnings of this banner ad is very poor according to the number of impressions it has.
    is there any strategy to apply inside my code or in ad mob ad setting for improving my estimated earning ?
    I have attached my banner ad data for last two months….
    https://uploads.disquscdn.com/images/a3fafb7452c39203d2b5a3bb7ec9c8d71828de1ddaf58696d70d0ee8b15fd11c.jpg

  • Dinozor Apps

    hi when I show interstitial ad the firstly click button it is open add and open new activity, but second click inactive… it is not working. how can refresh button when start interstitial and open that button for next activity

  • Hirpara Vivek

    how to set adblock in my app

  • Swati

    Hi Ravi, your tutorials are great and very helpful. In the above banner ad code there is no initialization without which it was not showing the banner.

  • Sandeep

    Sir in 3.1 Adding Banner ad what is xml

  • Sandeep

    What is xml layout in 3.1 where to ad these codes

  • Saidur Rahman

    Hi Ravi,

    I used exactly your code for Interstitial ads. It was all working fine for long time. But today I got email like this

    “LAYOUT
    ENCOURAGES ACCIDENTAL CLICKS – INTERSTITIAL ADS:
    ……………….Interstitial ads that load unexpectedly while a user
    is viewing the app’s content.”

    It would be great if you could let me
    know how to handle this scenario.

  • MARJAN KHAN

    Thanks A LOT!

  • Great example. Made easy! Thanks

  • Gowtham M

    very nice and simple thax lot….

  • Manik Mittal

    Hey Ravi I m unable to load banner adds what is the error with this

  • Ravinder Sharma

    Hello Ravi Bro.
    Please Tell Me Admob Advance Native Ad Implements Like App Install Ad, Content Ad Etc.
    Tell Me With Profits.

  • Jayesh Prajapati

    Hi
    Ravi
    Thanks for this.
    But how to repeat interstitial ad after 1 minute continuously.
    Thanks in advance

    • GVIEW TV

      Just add admob.oneminute. (remaining code) . It will work perfectly

    • Amit Arora

      I have android application and I need Ad code for banner ,help me in getting Ad Code

  • Ratanak Pek

    thanks, very nice and clear

  • hamy

    thats very nice thnks alot for this great help

  • Amit Arora

    From where can I get Ad code for my application ?

  • Amit Arora

    I have android application and I need Ad code for banner adds
    Can anybody help me in getting Ad Code ?

  • Furkan Özcan

    Hi Ravi. I add interstitial ad my app. But i have a problem. My ad see only first but not see other time.

  • Ḁyan Ḡhosh

    Hi Ravi,

    Can I include a video ad and note whether the user has watched till end or cancelled before it ended ?

    Please Tell me how. Thanks in advance 🙂

  • kush

    hello..thank you for that code. In emulator code work perfect but in my device not show the add..? what can i do for this…?

  • jim

    Hii Ravi..when i add test device it works perfectly fine but after removing and even after publishing adds doen’t show up

  • Kavita Patil

    Thank you .

  • Amitraj Sharma

    Hi Ravi,
    Ad failed to load! error code: getting everytime.

    • If it is a new ad ID, it takes sometime to display.

      • Amitraj Sharma

        Probably how much time it will take.

  • Nikunj D

    Hi Ravi,
    Is there any way to put x button in top right corner in MEDIUM_RECTANGLE Banner ad to close Banner Ad?

    • Don’t manipulate google ads. Your account will get banned.

      Place the Ad in a RelativeLayout and place the close button with align top, right to parent properties.

  • WAQAR ALAM

    when i close the interstatial ad logcat shows duplicate activity

    • naresh gaur

      i think you have same name two activity pls check

      • WAQAR ALAM

        In comment section I have posted a stackoverflow question link .
        Please check if you can

        • naresh gaur

          Am not able to find error pls copy error from android studio and paste here than i can recognise what is going on
          ..

  • Yasiir KhanY’x

    You need to add insted

    compile ‘com.google.android.gms:play-services-ads:11.0.0’

  • Puteri Pratiwi

    hallo sir,, how to implement native ads in recycleview android studio..,

    thanks you…

  • Riashad Sabit

    hello sir….I have done all this things…but these ads are only being shown when I am testing it on android emulator (Android Studio)…But when I am testing it on an actual device (like my phone),I can’t find these ads….So please tell me what should I do????

    • name

      it takes a few hours

  • Amit Raj

    Hello Ravi,
    Is it necessary to pay money in admob account because it’s automatically turns into beta version.And after creating banner and interstitial ad i am unable to display ad on my device.I have downloaded your apk and that is also not working.Please reply….

    • If the ad blocks are newly created it takes few hours to display them.

  • Team Work

    i follow all this step and put admob ad successfully but problem is that Ad perfect display in my mobile but on other mobile its display only 1(facebbook) ad

  • Mahantesh Gurav

    It worked for me. Nice Tutorial. I follow your all tutorials, keep it up..!

  • Manoz

    yes bro it work.

  • Ashish Tiwari

    Hi Ravi, I have to use Custom ads in an application. Is it possible to add/remove Ads dynamically form outside of Google’s Interface?

  • Poor Person

    Is it illegal if i make a app and then watch the ads MYSELF and my friends and earn money?
    i need some quick money

    • If you click or watch your own ads, your account will suspended by google very soon.

  • Shivam Bhardwaj

    Hi, is it possible to make an app for my business and set ads on it for my employees to use it in office hours, so that i can earn some extra money.

    • Yes, it can be. How big the team size would be?

      • Shivam Bhardwaj

        50-100

  • Alpesh Dumaniya

    I have one problem request to solve it
    when i put live apk i have shown admob ads and only in my device other device does not see any ads also

  • Muhammad Nauman

    hello Ravi I have a problem
    when I use Dummy ad uint Id admob appears dummy ads but when i put real ad unit idd no ads appears please help me out .

    • If the ad ids are new it takes 5min – 3,4 hours to display the actual ads. Also make sure you have removed the test device id.

      • Muhammad Nauman

        yes i have removed the test id and with the same ad ID on new app the ads appears

        • So is it working now?

          • Muhammad Nauman

            No its Not working Ravi

  • mohd afzal uddin

    hi my self salman im a software developer i have develop an app i need some help i want to add ads on my app and earn money soo how could i

    • That is what this article explains actually.

  • Rahul Maheshwari

    Best and unambiguous tutorial i found
    Thanks man!
    Cheers to you!!!