admob 只发送测试广告而不是真实广告

2024-05-31

我按照以下说明进行操作https://developers.google.com/mobile-ads-sdk/docs/admob/android/quick-start 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 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 会自动请求测试广告以防止这种情况发生。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

admob 只发送测试广告而不是真实广告 的相关文章

随机推荐