Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
490 views
in Technique[技术] by (71.8m points)

android - Admob shows Test ads but not real ads

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>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...