对于那些面临未来问题的人。
这里介绍的信息并不排除其他人已经说过的内容,它们只是补充,还有一些需要考虑的东西。
从2022年1月起,应用程序的设置过程在admob中发生了变化。一条通知被发送到控制台,信息如下。
所有添加到AdMob的新应用都需要经过审查和批准。
批准。请确保您的AdMob应用程序被链接到
到一个受支持的应用程序商店,以防止广告服务
中断。链接会产生对应用程序的自动审查。
如你所知,在admob中,有两种方法来配置一个应用程序。
Published
和
Unpublished.
If the app has already been published,和the SDK is implemented correctly, there will be no runtime errors, as long as the
广告政策
和
谷歌平台
If you haven't published your app yet but want to run和test ads, you need to adhere to best practices.
添加你的广告ID/IDFA,从你的物理设备上用来测试的
admob > settings > test-devices > create
可能是个好办法。
这将允许你保留你的设备作为测试,即使是在商店里发布之后。
当你调试时,不要在你的代码中使用
AdRequest.Builder.addTestDevice()
。它已经被停止使用了。
为了调试的目的,用
RequestConfiguration.Builder.setTestDeviceIds()
代替。你会有这样的结果。
public static final String TEST_J7 = "F1FDCA11111AF1111111FF11C1111111";
public static final String TEST_GRAN_PRIME = "F1FDCA11111AF1111111FF11C1111111";
public static final String TEST_XIAOMI = "F1FDCA11111AF1111111FF11C1111111";
public static final String TEST_EMULATOR = AdRequest.DEVICE_ID_EMULATOR;
// if you don't know the id, look it up in Logcat in a normal request
public void newConfiguration() {
String[] tests = {TEST_EMULATOR, TEST_J7, TEST_GRAN_PRIME, TEST_XIAOMI};
MobileAds.setRequestConfiguration(new RequestConfiguration.Builder()
.setTestDeviceIds(Arrays.asList(tests)).build());
始终使用测试广告,以防止交付被暂停。
public static final String TEST_UNIT_BANNER = "ca-app-pub-3940256099942544/6300978111";
public static final String TEST_UNIT_REWARD = "ca-app-pub-3940256099942544/5224354917";
public static final String TEST_UNIT_NATIVE = "ca-app-pub-3940256099942544/2247696110";
public static final String TEST_UNIT_INTERSTITIAL = "ca-app-pub-3940256099942544/1033173712";
public void loadAd(boolean is_test_device, String unit) {
if (is_test_device) {
newConfiguration();
AdRequest request = new AdRequest.Builder().build();
AdView banner = new AdView(c);
banner.setAdUnitId(is_test_device ? TEST_UNIT_BANNER : unit);
banner.loadAd(request);
//...
InterstitialAd.load(c, is_test_device ? TEST_UNIT_INTERSTITIAL : unit, request, /*callback*/);
//...
RewardedInterstitialAd.load(c, is_test_device ? TEST_UNIT_REWARD : unit, request, /*callback*/);
//...
根据文件规定。
Your app will receive limited ad serving until it is approved during the AdMob preparation process. In order for your app to be reviewed和approved by AdMob, you will need to list it on an AdMob-compatible store和link your app to the app store in your AdMob account.
The suspension of ads can last for up to 30 days, or be permanent in case of violation of 广告政策.
设置好你的测试设备后,重置你的广告ID,方法是进入Settings > Google > Ads > Reset Advertising ID在你的物理设备上。
Don't forget to use your own unit_id在你的分发应用程序中。
在这里了解更多。 关于应用程序的准备工作 设置一个测试装置