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

How to make it work? Thanks in advance #391

Open kilik911 opened 4 years ago

kilik911 commented 4 years ago

Hello everyone. I tried the instructions in the home page, but I still can't see the ad. Kindly help. I'm a rookie for cordova & javascript... Here is all what I've done in below. Thanks in advance.

  1. I've created a new project, added android & ios platform, added the plugin in CLI cordova plugin add cordova-plugin-admob-free --save --variable ADMOB_APP_ID="<MY_ANDROID_ADMOB_APP_ID>"

  2. Added the ID to Info.plist `

    MY_IOS_ADMOB_APP_ID

    `

  3. Added some code in the index.js file, here is how it look like: var app = {

index.txt

initialize: function() { document.addEventListener('deviceready', this.onDeviceReady.bind(this), false); }, onDeviceReady: function() { async function initAdd() { admob.banner.config({ // id: admobid.banner, id: 'ca-app-pub-3730818869995533/6699255664', isTesting: true, autoShow: true, }) await admob.banner.prepare(); await admob.banner.show(); alert('Ad loaded'); } initAdd(); }, app.initialize();

  1. Excute the cordova emulate android in the CLI, and I can see the device ready indicator & the alert. but I can't see the ad anywhere in the app.