How to access cordova AdMobPro plugin?
-
Hello!
I tried cordova.AdMob and cordova.plugins.AdMob but I still continue to get error “TypeError: Cannot read property ‘AdMob’ of undefined” .How to fix that?
-
Hi admob-pro plugin work for me:
try just AdMob and not cordova.AdMob or cordova.plugins.AdMobvar admobid = {
banner: _self.$root.config.admobid//your admob id
};
if (AdMob) AdMob.createBanner({
adId: admobid.banner,
position: AdMob.AD_POSITION.BOTTOM_CENTER,
autoShow: true,
success: function () {
console.log(‘fsuccessr’);
},
error: function () {
console.log(‘failed to create banner’);
}
}); -
Hello mate! Thank You so much for your help!
I tried your code but while building I got these errors:
✘ http://eslint.org/docs/rules/curly Expected { after ‘if’ condition
C:\Users\mustafa\Desktop\deneme\qua\src\components\Index.vue:44:5
if (AdMob) AdMob.createBanner({
^✘ http://eslint.org/docs/rules/no-undef ‘AdMob’ is not defined
C:\Users\mustafa\Desktop\deneme\qua\src\components\Index.vue:44:9
if (AdMob) AdMob.createBanner({
^✘ http://eslint.org/docs/rules/no-undef ‘AdMob’ is not defined
C:\Users\mustafa\Desktop\deneme\qua\src\components\Index.vue:44:16
if (AdMob) AdMob.createBanner({
^✘ http://eslint.org/docs/rules/no-undef ‘admobid’ is not defined
C:\Users\mustafa\Desktop\deneme\qua\src\components\Index.vue:45:13
adId: admobid.banner,
^✘ http://eslint.org/docs/rules/no-undef ‘AdMob’ is not defined
C:\Users\mustafa\Desktop\deneme\qua\src\components\Index.vue:46:17
position: AdMob.AD_POSITION.BOTTOM_CENTER,
^ -
I have a completelly different problem now.
Withouth any AdMob decleration, it says AdMob is not defined in vendor.jpg
What can I do?
-
Ok. Isolved admob decleration problem by “cordova platform remove android” and than add again.
However, there is still problem on using it in vue.
-
Ok solved.
here is the code I am using.
by the way, I needed to rebuild quasar and delete and recreate cordova android project
mounted () {
window.AdMob.createBanner({
adId: ‘ca-app-pub-3940256099942544/6300978111’,
position: window.AdMob.AD_POSITION.BOTTOM_CENTER,
autoShow: true })
}, -
@mustotto Do you mind sharing your code base? I’m having some difficulty in integrating admob as well. Thanks!