ratson / cordova-plugin-admob-free

New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova
https://github.com/admob-plus/admob-plus
MIT License
499 stars 214 forks source link

The plugin is not working anymore #390

Open yanbaha opened 4 years ago

yanbaha commented 4 years ago

Hey everyone There is something wrong with the plugin. It used to work without problems. Two days ago working with the same codes. Ads are displayed on Android Studio but not in a real device.

elkhalifte commented 4 years ago

its working bro , maybe you have a problem in your code or with your admob account.

yanbaha commented 4 years ago

its working bro , maybe you have a problem in your code or with your admob account.

I don't think so. My admob is working and the plugin still works in my old apps. it is just a few days ago that ads are not displayed anymore out of nothing. here is the code I use: `var admobid = {} if (/(android)/i.test(navigator.userAgent)) { // for android & amazon-fireos admobid = { banner: 'ca-app-pub-1266469958489664/5130585753', interstitial: 'ca-app-pub-1266469958489664/2252785750', } } else if (/(ipod|iphone|ipad)/i.test(navigator.userAgent)) { // for ios admobid = { banner: 'ca-app-pub-3940256099942544/2934735716', interstitial: 'ca-app-pub-3940256099942544/4411468910', } }

document.addEventListener('deviceready', function() { admob.banner.config({ id: admobid.banner, isTesting: false, autoShow: true, }) admob.banner.prepare()

admob.interstitial.config({ id: admobid.interstitial, isTesting: false, autoShow: true, }) admob.interstitial.prepare()

document.getElementById('showAd').disabled = true document.getElementById('showAd').onclick = function() { admob.interstitial.show() }

}, false)

document.addEventListener('admob.banner.events.LOAD_FAIL', function(event) { console.log(event) })

document.addEventListener('admob.interstitial.events.LOAD_FAIL', function(event) { console.log(event) })

document.addEventListener('admob.interstitial.events.LOAD', function(event) { console.log(event) document.getElementById('showAd').disabled = false })

document.addEventListener('admob.interstitial.events.CLOSE', function(event) { console.log(event)

admob.interstitial.prepare() })`

elkhalifte commented 4 years ago

your code seems to be ok , check your ad units code , and dont share your admob ad units anywhere bro :) .

elkhalifte commented 4 years ago

another thing maybe the problem is in your index.html if you have a non working js in there may causes a non working of admob.js . try to place cordova.js and admob.js in top of the head

yanbaha commented 4 years ago

another thing maybe the problem is in your index.html if you have a non working js in there may causes a non working of admob.js . try to place cordova.js and admob.js in top of the head

I don't know really what is the problem. However there is something I noticed; when I finish creating my project and enter the command "cordova prepare android" nothing happens. So I doubt if the plugin files are not completely added to the project. However as ads are displayed in Android Studio the plugin must work without problems.

soniaAguilarPeiron commented 4 years ago

When you run the app from an emulator automatically isTesting is true. In change, when you run it from a device, you have set isTetsting to false, so it is being done in real mode. So, it seems you have problems loading adds in real mode. This can be caused for several reasons: maybe your adMob account doesn't have payment method configured, or your app in store doesn't have the check 'this app contains ads' checked, and maybe another reason. I hope this help you.