我正在尝试实施AdMob奖励视频广告。在我实施测试/示例广告时,视频广告正在及时展示,但当我实施真实广告(广告单元ID)时,它并未显示真实视频广告。插页式广告在哪里展示完美且及时。我正在添加代码 -
ImageField
logcat也在这里 -
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
MobileAds.initialize(this, "ad unit ID");
prepareAd();
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(this);
mRewardedVideoAd.setRewardedVideoAdListener(this);
loadRewardedVideoAd();
adView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
adView.loadAd(adRequest);
}
public void prepareAd() {
mInterstitialAd = new InterstitialAd(this);
mInterstitialAd.setAdUnitId("ad unit ID");
mInterstitialAd.loadAd(new AdRequest.Builder().build());
}
@Override
protected void onStart() {
super.onStart();
isVisible = true;
if (scheduler == null) {
scheduler = Executors.newSingleThreadScheduledExecutor();
scheduler.scheduleAtFixedRate(new Runnable() {
public void run() {
Log.i("hello", "world");
runOnUiThread(new Runnable() {
public void run() {
if (mRewardedVideoAd.isLoaded() && isVisible) {
mRewardedVideoAd.show();
} else {
Log.d("TAG", " Interstitial not loaded");
displayInterstitial();
}
prepareAd();
}
});
}
}, 42, 42, TimeUnit.SECONDS);
}
}
private void loadRewardedVideoAd() {
if (!mRewardedVideoAd.isLoaded()) {
mRewardedVideoAd.loadAd("ad unit ID",
new AdRequest.Builder().build());
}
}
这是我的布局页面: -
01-28 17:41:32.357 7200-30384/com.deb.srikishnerastottorosotonam I/hello: world
01-28 17:41:32.357 7200-7200/com.deb.srikishnerastottorosotonam D/TAG: Interstitial not loaded
01-28 17:41:32.384 7200-7200/com.deb.srikishnerastottorosotonam D/DynamitePackage: Instantiating com.google.android.gms.ads.ChimeraAdManagerCreatorImpl
01-28 17:41:32.413 7200-7200/com.deb.srikishnerastottorosotonam I/Ads: Starting ad request.
01-28 17:41:32.414 7200-7200/com.deb.srikishnerastottorosotonam I/Ads: Use AdRequest.Builder.addTestDevice("8D2245D8347B7CF7C7C2C4B37E12F275") to get test ads on this device.
01-28 17:41:33.225 7200-7200/com.deb.srikishnerastottorosotonam D/cr_Ime: [InputMethodManagerWrapper.java:30] Constructor
01-28 17:41:33.229 7200-7200/com.deb.srikishnerastottorosotonam W/cr_AwContents: onDetachedFromWindow called when already detached. Ignoring
01-28 17:41:33.230 7200-7200/com.deb.srikishnerastottorosotonam D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
01-28 17:41:33.270 7200-7200/com.deb.srikishnerastottorosotonam I/cr_Ime: ImeThread is not enabled.
01-28 17:41:33.305 7200-7200/com.deb.srikishnerastottorosotonam W/cr_BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 7200
01-28 17:41:33.305 7200-7200/com.deb.srikishnerastottorosotonam D/cr_Ime: [InputMethodManagerWrapper.java:59] isActive: false
01-28 17:41:33.653 7200-7200/com.deb.srikishnerastottorosotonam I/Ads: Ad finished loading.
01-28 17:41:34.938 7200-7200/com.deb.srikishnerastottorosotonam I/Ads: Ad is not visible. Not refreshing ad.
01-28 17:41:34.938 7200-7200/com.deb.srikishnerastottorosotonam I/Ads: Scheduling ad refresh 60000 milliseconds from now.