我按照 https://developers.google.com/mobile-ads-sdk/docs/admob/android/quick-start 上的说明进行操作
我将 strings.xml 中的测试代码更改为真实代码。但是该应用程序仍在显示测试广告。(我还没有在 Play 商店上发布该应用程序)
它像这样出现在模拟器中 https://drive.google.com/file/d/0B6InEecSXedCNmM4eUVrTzVGaFU/view?usp=sharing 这是activity_main.xml代码
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>
这是java代码的一部分
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);
}
最佳答案
Google 移动广告 SDK 只会在模拟器上显示测试广告。如果您切换到在真实设备上进行调试,除非您使用 addTestDevice 调用注册设备,否则您将看到实时的生产广告。
正如 Abishek 指出的那样,在测试和调试时请求真实广告是违反 AdMob 政策的,这可能会导致您的帐户被暂停。 SDK 会自动请求测试广告以防止这种情况发生。
关于android - admob 只发送测试广告而不发送真实广告,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29489287/