Placing AdMob banner on bottom of screen [ERROR]


#1

I am using position : AdMob.AD_POSITION.BOTTOM_CENTER

but in VS Code it shows error and says [ts] Property ‘AD_POSITION’ does not exist on type ‘typeof AdMob’.

so hope it will create an error…is it correct or is there any other way to position Admob banner?


#2

Seems ok, but please post your json options configuration…


#3

on build it showing error only…

[21:57:25] typescript: C:/Users/BhatRitesh/Desktop/Think-Digital/kamarajar/src/providers/plugin.ts, line: 46
Property ‘AD_POSITION’ does not exist on type ‘typeof AdMob’.

L45: adId : admobId.banner,
L46: position : AdMob.AD_POSITION.BOTTOM_CENTER,
L47: [21:57:25] ngc failed: Failed to transpile TypeScript autoShow : true

[21:57:25] ionic-app-script task: “build”
[21:57:25] Error: Failed to transpile TypeScript


#4

I use this config

var banner_opt= { adId: admob_key, position:AdMob.AD_POSITION.BOTTOM_CENTER, autoShow: true, overlap: false, offsetTopBar: false };
but with ionic1, what is your config?


#5

AdMob.createBanner({
adId : admobId.banner,
position : AdMob.AD_POSITION.BOTTOM_CENTER,
autoShow : true
});

i am usinng ionic 2


#6

If you use only adId, it works?


#7

Check the file: plugins/cordova-plugin-admobpro/www/AdMob.js (or something), at the top you can find positions and sizes definitions… maybe it can help…


#8

i looked into to docs of admob plugin it says to use

AdMob.createBanner({
adId: admobid.banner,
position: AdMob.AD_POSITION.TOP_CENTER,
autoShow: true });

dont know how this wil be solved…


#9

Any progress on this? I tried to replace AdMob.AD_POSITION.TOP_CENTER with 8, that is the same value found in the plugin source code, and I don’t have any error in the code now. Still, ads simple don’t appear and I don’t know how to further debug the issue…


#10

The issue is caused by the IDE, because in the Ionic Native code there is /** @private **/ before the property declaration.

You can manually edit the typings or use the int value of those constants instead. See here for more details: https://github.com/driftyco/ionic-native/blob/master/src/plugins/admob.ts#L122-L134