问题
I followed instructions on https://developers.google.com/mobile-ads-sdk/docs/admob/android/quick-start
I changed the test code in strings.xml to real code. But the app is still showing test ads.(I have not posted the app on play store)
It appears in emulator like this https://drive.google.com/file/d/0B6InEecSXedCNmM4eUVrTzVGaFU/view?usp=sharing Here is activity_main.xml code
android:layout_alignRight="@+id/adView"
android:layout_alignEnd="@+id/adView" />
<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_ad_unit_id"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
</com.google.android.gms.ads.AdView>
and here is a part of java code
Button = (ImageButton) findViewById(R.id.button);
Button.setOnClickListener(new MyOnClickListener());
AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
}
回答1:
The Google Mobile Ads SDK will only display test ads on the emulator. If you switch to debugging on a real device, you will see live, production ads unless you register the device with the addTestDevice call.
As Abishek points out, it is a violation of AdMob policy to request real ads when you're testing and debugging, and this can result in the suspension of your account. The SDK automatically requests test ads to prevent this from happening.
回答2:
You cannot use the live ads during development as it is against AdMob policy to use live ads during development, and doing so could cause the suspension of your AdMob account.
回答3:
You have to change the banner ad unit id. because its the test id, that shows the test ad. You can find them in the strings.xml
<string name="banner_ad_unit_id" translatable="false">pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxx</string>
来源:https://stackoverflow.com/questions/29489287/admob-only-sends-test-ad-not-real-ads