61

I'm using admob for showing android ads. The test ads are working fine but real ads are not shown. Also, I've no issue with real interstitial ads as they work fine. Just the real banner ads are not showing up. My java code is

private InterstitialAd interstitial;    
interstitial = new InterstitialAd(MainActivity.this);

        interstitial.setAdUnitId("ca-app-pub-********");

        AdView adView = (AdView) this.findViewById(R.id.adView);               
        AdRequest adRequest = new AdRequest.Builder()

        // Add a test device to show Test Ads
         .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
         .addTestDevice("4CCC00EF4EA205A6FE82E1AEB26B0839")
                .build();

        // Load ads into Banner Ads
        adView.loadAd(adRequest);

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

The Layout file is

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <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="ca-app-pub-********" />

</LinearLayout>
Vishal Afre
  • 1,013
  • 3
  • 12
  • 39

17 Answers17

59

When apps are newly registered with AdMob, it takes some time and a few ads requests to allow inventory to build. Because of this, you may not see live impressions immediately. Once your app starts making more requests, you should see more consistent results. Please note that test ads operate through the same channels as live ads. Being able to return a test ad ensures that your application is communicating properly with our network. Be patience it will work after some days.

Mukesh Chauhan
  • 791
  • 8
  • 9
  • I have the same issue and its been 2 days my real ads (banner ad) is not displayed .. how many days do i have to wait more ? Here is my published app url:https://play.google.com/store/apps/details?id=usol.com.tollamasharaticonverter – Usman lqbal Jan 20 '19 at 07:14
  • 13
    If you do all the programming right but you do not fill up payment info, your test ads shows up correctly but production ads not. So, even test ads operates through same channels as live ads you can experience this problem. – Jindřich Skeldal Feb 22 '19 at 07:57
  • 2
    @Usmanlqbal I checked your ads are now coming, how did you solve the issue? – Manohar Reddy Poreddy Mar 05 '19 at 07:00
  • Really? two weeks is a lot, does anyone knows how to make that time shorter? – dmarquina Jun 11 '19 at 16:43
  • Sir, this time could be shorter automatically if your app is getting good traffic. If there is no genuine traffic in your app, then it might take more time. – Mukesh Chauhan Jun 12 '19 at 07:07
  • 1
    All my ads are showing NO_FILL, even after four months. I've tried multiple aps, even rewriting the entire thing in Xamarin, and I've never, ever seen a single live ad show up. I cannot release any of the apps I've made. All test ads work in every single app, but even after four months, I have seen 0 fills. What should I do? – Apache Jul 08 '19 at 16:18
  • In my application I applied Both test ads (banner and interstitial) they are showing perfectly but when I apply real ads Both of them did not display. I wait for 1 day and after one day only banner ads are showing now interstitial ads are not showing ( my ads id where generated 1 years before than why I need to wait 1 day to show in my application after uploading to google play store. Now how can I display Interstitial ads please? – Developer Oct 12 '19 at 13:16
19

Remove the line that says

.addTestDevice("4CCC00EF4EA205A6FE82E1AEB26B0839")

Also, when you use a virtual device, it shows the test ads no matter what. Are you testing it on a real device?

Marshall
  • 1,353
  • 3
  • 17
  • 38
  • Yeah, I'm testing on real device... If I keep that line then I get a test ad on my real device... But no ad when I remove the line – Vishal Afre Mar 09 '15 at 18:55
  • 1
    Of course... Had I not added them in my manifest then how could have I got real interstitial ads – Vishal Afre Mar 10 '15 at 03:43
  • silly. i test it on my own device that registered as test device. i test on another device and real ads showed. yeay. – axunic Mar 25 '19 at 09:01
  • test banner and test interstitial ads are showing perfectly but real interstitial are not showing while real banner ads are also showing perfectly. – Developer Oct 12 '19 at 13:18
13

You might be using the sample unit id: ca-app-pub-3940256099942544/6300978111

If you use above then you will see test ads.

Make sure you change to your own unit id before releasing the app.

Vikas
  • 4,263
  • 1
  • 34
  • 39
10

"It could be that you have only recently created a new Ad Unit ID and requesting for live ads. It could take a few hours for ads to start getting served if that is that case."

I faced the same problem, if you can show test ads, it's fine, live ads will be showed soon (of course after you removed .addTestDevice(...) ).

I guess that google need time to collect some information (location, age, gender...) to show properly ads that can interest user.

May be you know but NEVER forget: DO NOT touch the live ads, you will be banned soon.

https://groups.google.com/forum/#!category-topic/google-admob-ads-sdk/android/fBe3YL3ffpo

Phong Nguyen
  • 6,897
  • 2
  • 26
  • 36
6

If you have removed:

.addTestDevice()

Then, make sure you are using the same ID that AdMob gave you in your string.xml file

AdMob ID page

Javier Castro
  • 93
  • 2
  • 6
6

Below is the official answer for time required to pass in order to display live ads.

How long does it take for ads to begin appearing after the first ad request?

When apps are newly registered with AdMob, it typically takes up to an hour and a few ad requests to allow inventory to build. Because of this, you may not see live impressions immediately.

Note: In some cases, it may take longer than an hour. Please wait 24 hours before seeking additional help.

Once your app is making more requests, you should see more consistent results. Please note that test ads operate through the same channels as live ads. Being able to return a test ad ensures that your application is communicating properly with our network.

Source: https://support.google.com/admob/answer/2993019?hl=en

EEE
  • 4,536
  • 3
  • 28
  • 34
6

You have to add your payment information first. I forgot to do this in Google Admob so it wasn't showing any ads.

Also, make sure you use real Ad ID instead of the test ids.

Sarvesh Sridhar
  • 387
  • 3
  • 3
5

Answering an old question, but I had faced this same issue that test ads are visible and production key's Ads are not working.

I figured out later that I didn't gave my payment details to Admob.

Payment details in Admob are a must. Please update and check after few hours it starts appearing.

Nikola G.
  • 335
  • 1
  • 3
  • 9
Sreedhu Madhu
  • 2,480
  • 2
  • 30
  • 40
4

To create a Live Ad unit id

Sign In to

https://apps.admob.com

  1. in the left side menu click on ->Apps
  2. add app
  3. choose whether you have published your app on Google Play or the App Store
  4. if no -> Enter your app information
  5. Create Ad unit
  6. replace the test Ad unit with the new Ad unit.
  7. you get to see the AD once the app is published to playstore!

inside your xml add AdView

  <com.google.android.gms.ads.AdView 
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:id="@+id/adView"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"

    android:layout_alignParentBottom="true"
    android:layout_centerHorizontal="true"
    ads:adSize="BANNER"
    ads:adUnitId="@string/banner_ad_unit_id">
  </com.google.android.gms.ads.AdView>

inside Strings <string name="banner_ad_unit_id">your_new_ad_unit</string>

in your java code

 AdView mAdView = (AdView) v.findViewById(R.id.adView);
 AdRequest adRequest = new AdRequest.Builder().build();
 mAdView.loadAd(adRequest);
Amrutha Saj
  • 1,408
  • 16
  • 35
3

Look at your logcat. It will say why real ads are not being shown.

It's probably because there are none available to show for your device, in your location, right now.

William
  • 20,150
  • 8
  • 49
  • 91
  • May be... Or is it so that I've just created ca-pub id for the ad and it takes some time to make the ads available??? – Vishal Afre Mar 10 '15 at 03:46
  • That's the same scenario. – William Mar 10 '15 at 07:52
  • I checked the Logcat. It says "No fill from ad server". What could that mean?? – Vishal Afre Mar 10 '15 at 09:05
  • 1
    That means that the ad server currently has no ads to show for you. Exactly what I said it might. This is an expected state. It will happen from time to time. – William Mar 11 '15 at 10:28
  • But I recently heard that it comes because your app is suspended from play store.... But I haven't published my app on play store yet... So can't I get live banner ads on real devices (unlike interstitial ads that I'm getting) until I upload it on play store???? – Vishal Afre Mar 11 '15 at 13:33
  • 1
    No. Whether ads are served is totally orthogonal to whether your app has been published on Google Play. – William Mar 12 '15 at 01:36
  • @vishal Afre. Recently admob is showing ads on suspended apps also. That too only Test ads. So better leave admob if your app suspended on admob. Bingo!!! – Ramesh_D Feb 17 '16 at 07:40
3

Generally, it is happening because of two reasons:

  1. You defined your device as test device.
  2. If you are using emulator android studio, you always see test ads.

According to Google documentation, android emulators & ios simulators are automatically configured as test devices.

enter image description here

For more information check Google Web Site.

achinthaishane
  • 77
  • 1
  • 2
  • 9
canerkaseler
  • 6,204
  • 45
  • 38
1

I also was faced with this problem. AdView and IntersitialAd showed me only test advertisements on the simulator. But there were real advertisements on the real device. I think that firebase can detect if you use the simulator or the real device. I've used firebase:

com.google.firebase:firebase-ads:11.0.4

Kiryl Bielašeŭski
  • 2,663
  • 2
  • 28
  • 40
1

In my case, it was because of wrong keystore file path in app > build.gradle. Make sure you have correct storeFile file('file path')enter image description here

I am sure it will help someone find the answer.

Adnan Afzal
  • 167
  • 1
  • 3
  • 8
1

I had the same problem and thought I would never be able to fix it.

Reason of the error: Admob is showing test ads because the ad loaded from admob does not fit in the container, mostly a linear layout because the ad loaded is bigger in width.

Fix: How I fixed was to create a banner ad of custom size of 320x50 and then load it.

I'm unable to post my code in the answer, but you can figure out your own from Jay Patel's answer to the following stackoverflow question.

How to set adSize?

Stefano Sansone
  • 2,377
  • 7
  • 20
  • 39
Wakeel Ahmad
  • 43
  • 10
0

If you chose the Native Express template then use this link. NativeExpressAdView won't work with AdView. https://firebase.google.com/docs/admob/android/native-express

NativeExpressAdView adView = (NativeExpressAdView)findViewById(R.id.adView);

<com.google.android.gms.ads.NativeExpressAdView
    android:id="@+id/adView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    ads:adUnitId="ca-app-123123123123/123123123"
    ads:adSize="320x150">
</com.google.android.gms.ads.NativeExpressAdView>
Adam Mendoza
  • 5,419
  • 2
  • 25
  • 31
0

Actually, I also faced this problem. You have to log in to admob and go to the app you added there. That app has an admob id. Use the id of the app to do these steps. Then create a new banner or whatever type of ad in that app (in admob) and use the id of that banner to complete these steps. When you create a banner, it will give you the instructions itself.

Umer
  • 566
  • 6
  • 13
  • Can you add what relevant steps are needed from your links? – ivcubr Aug 16 '18 at 12:50
  • These are not only steps, it is a full tutorial on developer.google.com so I felt, instead of rewriting it all, one can visit and see it himself. – Umer Aug 17 '18 at 12:54
0

It probably is not showing Ad because your app is still in development mode, you can register a test device in your ad mob account by following the instructions here. You should be able to see the ads on a test device even in development mode.

Copying the steps here

  • Sign in to your AdMob account at https://apps.admob.com.
  • Click Settings in the sidebar.
  • Click the Test devices tab.
  • Click Add test device.
  • Select the platform of your device.
  • Enter a device name. Consider using a name that will help you quickly identify your devices in your AdMob account. Note: The device name will be visible to anyone who has access to your AdMob account.
  • Enter your Advertising ID/IDFA. Learn how to find your advertising ID/IDFA.
  • Select a gesture to use to activate ad inspector: None, Shake OR Flick twice
  • Click Done.
avinash
  • 523
  • 1
  • 5
  • 10