我正在将Admob广告添加到我的应用中,我以前使用过横幅广告,但我现在正在尝试使用InterstitialAd和Rewarding视频,我已经添加了并且我确定:
我的代码如下:
InterstitialAd mInterstitialAd = new InterstitialAd(context);
mInterstitialAd.setAdUnitId("MYACCOUNT/MYADUNIT");
AdRequest adRequest = new AdRequest.Builder().addTestDevice("283D63FED5A2DD63F96FDE3EBF4F5D1F").build();
mInterstitialAd.loadAd(adRequest);
if(mInterstitialAd.isLoaded())
mInterstitialAd.show();
帐户/ ID单元是正确的,日志显示:
I/Ads: Starting ad request.
type=1400 audit(0.0:34603): avc: denied { read } for name="mem" dev="debugfs" ino=6327836 scontext=u:r:untrusted_app:s0 tcontext=u:object_r:debugfs:s0 tclass=file op_res=-13 ppid=674 pcomm="main" tgid=674 tgcomm="main"
I/Ads: Ad finished loading.
I/Ads: Starting ad request.
E/Ads: JS: Uncaught ReferenceError: AFMA_ReceiveMessage is not defined (:1)
I/Ads: Scheduling ad refresh 60000 milliseconds from now.
I/Ads: Ad finished loading.
E/Ads: JS: Uncaught Error: apmc:nocon (https://pagead2.googlesyndication.com/pagead/js/r20160726/r20110914/abg.js:32)
现在,奖励视频,代码如下:
mAd = MobileAds.getRewardedVideoAdInstance(getActivity().getApplicationContext());
mAd.setRewardedVideoAdListener(SettingsFragment.this);
mAd.loadAd("ACCOUNT/ADUNIT", new AdRequest.Builder().addTestDevice("283D63FED5A2DD63F96FDE3EBF4F5D1F").build());
if (mAd.isLoaded()) {
mAd.show();
}
记录:
I/Ads: Starting ad request.
W/Ads: There was a problem getting an ad response. ErrorCode: 0
W/Ads: Failed to load ad: 0
这里有什么问题?一切都是正确的,并且在SDK之后,广告是在7小时前创建的。
答案 0 :(得分:0)
所以我在Google论坛中得到了官方Admob SDK团队的答案。
对于插页式问题,我需要在InterstitialAd中的“OnLoaded”侦听器中设置“isLoaded”和“showAd”。
对于视频问题,视频奖励没有测试广告,我还需要与视频奖励相关联的有效冥想帐户。