admob 只发送测试广告而不发送真实广告
admob only sends test ad not real ads
我遵循了 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);
}
您不能在开发期间使用实时广告,因为在开发期间使用实时广告违反 AdMob 政策,这样做可能会导致您的 AdMob 帐户被暂停。
Google 移动广告 SDK 只会在模拟器上显示测试广告。如果您切换到在真实设备上进行调试,除非您使用 addTestDevice 调用注册设备,否则您将看到实时的生产广告。
正如 Abishek 指出的那样,在测试和调试时请求真实广告违反了 AdMob 政策,这可能会导致您的帐户被暂停。 SDK 会自动请求测试广告以防止这种情况发生。
您必须更改横幅广告单元 ID。因为它是测试 ID,所以会显示测试广告。您可以在 strings.xml
中找到它们
<string name="banner_ad_unit_id" translatable="false">pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxx</string>
我遵循了 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);
}
您不能在开发期间使用实时广告,因为在开发期间使用实时广告违反 AdMob 政策,这样做可能会导致您的 AdMob 帐户被暂停。
Google 移动广告 SDK 只会在模拟器上显示测试广告。如果您切换到在真实设备上进行调试,除非您使用 addTestDevice 调用注册设备,否则您将看到实时的生产广告。
正如 Abishek 指出的那样,在测试和调试时请求真实广告违反了 AdMob 政策,这可能会导致您的帐户被暂停。 SDK 会自动请求测试广告以防止这种情况发生。
您必须更改横幅广告单元 ID。因为它是测试 ID,所以会显示测试广告。您可以在 strings.xml
<string name="banner_ad_unit_id" translatable="false">pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxx</string>