Closed wo-github closed 6 years ago
You need to check this before you initialize anything
if ( window.plugins && window.plugins.AdMob ) {
also where is this bit?
var ad_units = {
ios : {
banner: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx', //PUT ADMOB ADCODE HERE
interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx' //PUT ADMOB ADCODE HERE
},
android : {
banner: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx', //PUT ADMOB ADCODE HERE
interstitial: 'ca-app-pub-xxxxxxxxxxx/xxxxxxxxxxx' //PUT ADMOB ADCODE HERE
}
};
var admobid = ( /(android)/i.test(navigator.userAgent) ) ? ad_units.android : ad_units.ios;
Thats not the problem. The check is there and the variables too. This code works with ios and with the testbanner. And I can insert the ios Add-Ids and it doesnt work on Android.
if ( window.plugins && window.plugins.AdMob ) {
var ad_units = {
ios : {
banner: 'ca-app-pub-xxxxx',
interstitial: 'ca-app-pub-xxxxx'
},
android : {
banner: 'ca-app-pub-xxxxx',
interstitial: 'ca-app-pub-xxxxx'
}
};
if ( device.platform == 'android' || device.platform == 'Android' || device.platform == "amazon-fireos" ){
var admobid = ad_units.android;
} else {
var admobid = ad_units.ios;
}
window.plugins.AdMob.setOptions( {
publisherId: admobid.banner,
interstitialAdId: admobid.interstitial,
adSize: window.plugins.AdMob.AD_SIZE.SMART_BANNER, //use SMART_BANNER, BANNER, LARGE_BANNER, IAB_MRECT, IAB_BANNER, IAB_LEADERBOARD
bannerAtTop: false, // set to true, to put banner at top
overlap: false, // banner will overlap webview
offsetTopBar: false, // set to true to avoid ios7 status bar overlap
isTesting: true, // receiving test ad
autoShow: false // auto show interstitial ad when loaded
});
registerAdEvents();
window.plugins.AdMob.createInterstitialView();
window.plugins.AdMob.requestInterstitialAd();
showAdMob();
}
When did you register the admob ids? Sometimes they dont serve ads to them for 24 hours. Also is the android app signed? If it's not signed when you test they may also not serve ads.
The Admob IDs are registered some month ago and the error happens also after build and sign the android app.
If Ads are like in-app-purchases on Android, you may have to build/sign the app with the same config versions that were approved in the App store?
For me, my config.xml has
android-versionCode="27" versionCode="27"
So after I publish that version to the store (and it's approved), when I am trying to debug my next version, I have to leave these version numbers the same. If I increment them, then my in-app-purchases do not work (since that newer "version" has not been approved to access that feature).
I only increment the version numbers when I do the final build just prior to uploading to the store.
Just a shot-in-the-dark as to what your issue may be....
Can you tell me your app id?
If we use this plugin, everything is fine on ios. But the same code doesn`t work on Android. The error event
shows the following:
This happens only with the live Banner. If we call the banner in testmode, everything is fine and the banner is shown.
Our code: