昨天我在Android应用中使用Admob制作了插页式广告。
测试显示正常,但是如果我放置真实的AdUnitId,则广告无法加载。
这是我的代码
MobileAds.initialize(this, "ca-app-pub-***");
mInterstitialAd = new InterstitialAd(getActivity());
mInterstitialAd.setAdUnitId("ca-app-pub-**");
mInterstitialAd.loadAd(new AdRequest.Builder().build());
mInterstitialAd.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
// Code to be executed when an ad finishes loading.
Log.i("Ads", "onAdLoaded");
mInterstitialAd.show();
}
});