我在Android上设置了广告,就像在资源部分一样,但是我看不到任何广告,我看过logcat,它说插页式广告已准备就绪,但在测试MobileCore.isReady
时它会返回false。广告设置已设置ad默认触发器,我已将必要的部件添加到清单中。
public void setupMobileCore() {
if(payVersion)return;
MobileCore.setAdUnitEventListener(new AdUnitEventListener() {
@Override
public void onAdUnitEvent(MobileCore.AD_UNITS adUnit, EVENT_TYPE eventType,
MobileCore.AD_UNIT_TRIGGER... trigger) {
if(adUnit == MobileCore.AD_UNITS.INTERSTITIAL && eventType == AdUnitEventListener.EVENT_TYPE.AD_UNIT_INIT_SUCCEEDED) {
MobileCore.loadAdUnit(MobileCore.AD_UNITS.INTERSTITIAL, MobileCore.AD_UNIT_TRIGGER.DEFAULT);
}
if(adUnit == MobileCore.AD_UNITS.INTERSTITIAL && eventType == AdUnitEventListener.EVENT_TYPE.AD_UNIT_DISMISSED) {
for(MobileCore.AD_UNIT_TRIGGER myTrigger:trigger){
if(myTrigger.equals(MobileCore.AD_UNIT_TRIGGER.DEFAULT)){
MobileCore.loadAdUnit(MobileCore.AD_UNITS.INTERSTITIAL, MobileCore.AD_UNIT_TRIGGER.DEFAULT);
}
}
}
}
});
MobileCore.init(this, "FEBF7G6ISDBDIFTD7XBJ69PYWBQQ", MobileCore.LOG_TYPE.DEBUG, MobileCore.AD_UNITS.INTERSTITIAL);
}
protected static int interstitialsShownNum = 1;
protected void showInter() {
if(payVersion)return;
if (interstitialsShownNum++ % 2 != 0) {//show admob most time
if (adInter.isLoaded()) {
adInter.show();
}
}
else {
if (MobileCore.isReady(MobileCore.AD_UNITS.INTERSTITIAL, MobileCore.AD_UNIT_TRIGGER.DEFAULT)) {
MobileCore.showInterstitial(this, MobileCore.AD_UNIT_TRIGGER.DEFAULT, null);
}
}
}
日志
02-25 13:24:05.389: I/MobileCore(13698): mobileCore SDK: Initializing ad_unit_interstitial
02-25 13:24:06.109: I/MobileCore(13698): mobileCore SDK: Initialized successfully ad_unit_interstitial
02-25 13:24:06.109: I/MobileCore(13698): mobileCore SDK: Loading ad_unit_interstitial trigger DEFAULT
02-25 13:24:08.459: I/MobileCore(13698): mobileCore SDK: ad_unit_interstitial trigger DEFAULT is ready
02-25 13:24:19.544: I/MobileCore(13698): MobileCore was already initialized
02-25 13:24:23.079: I/MobileCore(13698): mobileCore SDK: Requesting to show ad_unit_interstitial trigger DEFAULT
02-25 13:24:23.149: I/MobileCore(13698): mobileCore SDK: Failed to show ad_unit_interstitial trigger DEFAULT
我认为它是一个错误或没有可用的库存,我在日本。是否有测试模式,因此可以看到它是否正确实施而无需本地库存。