我正在考虑将奖励视频广告实施为连续的全屏广告,直到用户手动打断原本无休止的广告序列。我尝试实施了 Admob奖励视频广告,一个又一个地播放,但是它无法正常运行,更糟糕的是,这似乎不是Google的预期行为,因此似乎没有任何工具可以实现此所需功能。
让我们看看由 Google Admob 提供的代码:
MobileAds.initialize(this, "ca-app-pub-4824494878097656/8403117409");
// Use an activity context to get the rewarded video instance.
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(objGloContext);
mRewardedVideoAd.setRewardedVideoAdListener(new RewardedVideoAdListener() {
@Override
public void onRewardedVideoAdLoaded() {
if (mRewardedVideoAd.isLoaded()) {
mRewardedVideoAd.show(); //this shows ad immediately
}
}
@Override
public void onRewardedVideoAdOpened() {
}
@Override
public void onRewardedVideoStarted() {
}
@Override
public void onRewardedVideoAdClosed() {
}
@Override
public void onRewarded(RewardItem rewardItem) {
}
@Override
public void onRewardedVideoAdLeftApplication() {
}
@Override
public void onRewardedVideoCompleted() {
mRewardedVideoAd.destroy(objGloContext);
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(objGloContext);
mRewardedVideoAd.loadAd("ca-app-pub-3940256099942544/5224354917", new AdRequest.Builder().build()); //use this id for testing
}
@Override
public void onRewardedVideoAdFailedToLoad(int i) {
Toast.makeText(getApplicationContext(), "onRewardedVideoAdFailedToLoad", Toast.LENGTH_SHORT ).show();
}
});
据我所知,Google并没有提供任何指令以编程方式关闭广告,而destroy也不提供关闭指令,因此
我无法在onRewardedVideoCompleted()
中递归地重新启动它。
然后,您还有其他想法吗?谢谢