我尝试添加AdMob将在我的PhoneGap的应用程序,但他不工作,我不知道为什么:/AdMob联播的PhoneGap不起作用
function domLoaded(){
alert("loaded");
var IS_APP = document.URL.indexOf('http://') === -1 && document.URL.indexOf('https://') === -1;
var ad_units = {
ios : {
banner: 'ca-app-pub-6944053263628084/2993763855', // votre référence fournie par AdMob pour cette application
interstitial: 'ca-app-pub-6944053263628084/5947230254' // votre référence fournie par AdMob pour cette application
},
android : {
banner: 'ca-app-pub-6944053263628084/9994470251', // votre référence fournie par AdMob pour cette application
interstitial: 'ca-app-pub-6944053263628084/3947936653' // votre référence fournie par AdMob pour cette application
}
};
// le code s'adapte en fonction de la platforme
var admobid = (/(android)/i.test(navigator.userAgent)) ? ad_units.android : ad_units.ios;
if(IS_APP && AdMob) { // on vérifie que c'est un mobile et que AdMob est bien chargé
if(Math.floor(Math.random()*5) === 1) { // 1 fois sur 5 on affiche l'interstitial
AdMob.prepareInterstitial({
adId:admobid.interstitial,
autoShow:true}
);
}
else {
AdMob.createBanner({ // 4 fois sur 5 la bannière
adId:admobid.banner,
position:AdMob.AD_POSITION.BOTTOM_CENTER,
autoShow:false,
overlap:true}
);
}
}
//AdMob.showInterstitial(); // pour afficher la pub interstitial précédemment chargée
// pour afficher la bannière publicitaire précédemment chargée
//AdMob.hideBanner();
AdMob.showBanner();
}
function showBanner(){
}
这里是我的“Pub.js”
警报( “装”)的作品好,当我打电话domLoaded()
$(document).ready(function(){
domLoaded();
});
我就使 “的PhoneGap本地插件add.admob.google”
,我的config.xml中有
可能重复http://stackoverflow.com/questions/30469049/admob-integration- for-phonegap-doesnt-show-the-advertise – Miquel
有效的admob插件ID是:com.google.cordova.admob,您可以直接将示例index.html复制到您的www /测试:https:// github。 com/floatinghotpot/cordova-admob-pro/blob/master/test/index.html –