我在PhoneGap中构建了一个示例应用程序,并使用https://github.com/floatinghotpot/cordova-admob-pro插件将AdMob广告集成到其中。广告在未发布阶段运行良好,但是在我从Play商店安装广告后,没有显示任何广告,如果是插件问题或代码问题,您能告诉我是怎么回事。
我已经使用了这段代码
var admobid = {};
if( /(android)/i.test(navigator.userAgent) ) {
admobid = { // for Android
banner: 'ca-app-pub-8163065164108970/8189467434',
interstitial: 'ca-app-pub-8163065164108970/7447231403',
rewardvideo: 'ca-app-pub-3940256099942544/5224354917',
};
}
function initApp() {
AdMob.createBanner( {
adId: admobid.banner,
position: AdMob.AD_POSITION.BOTTOM_CENTER,
overlap: false,
offsetTopBar: false,
bgColor: 'black'
} );
// this will load a full screen ad on startup
AdMob.prepareInterstitial({
adId: admobid.interstitial,
autoShow: true
});
}
if(( /(ipad|iphone|ipod|android|windows phone)/i.test(navigator.userAgent) )) {
document.addEventListener('deviceready', initApp, false);
} else {
initApp();
}
并这样添加plugin.xml
<plugin name="cordova-plugin-admobpro" source="npm">
<variable name="PLAY_SERVICES_VERSION" value="16.0.0" />
</plugin>