javascript - Adding admob ads to phonegap app -
i using phonegap build
i beginner javascript
now gone along
https://github.com/floatinghotpot/cordova-admob-pro/wiki/00.-how-to-use-with-phonegap-build
my config.xml
contains
<gap:plugin name="com.google.cordova.admob" source="plugins.cordova.io" />
and index.html
contain these js , html
var admobid = {}; if( /(android)/i.test(navigator.useragent) ) { admobid = { // android banner: 'ca-app-pub-5064752282990502/4341809673', interstitial: 'ca-app-pub-5064752282990502/5818542873' }; } else if(/(ipod|iphone|ipad)/i.test(navigator.useragent)) { admobid = { // ios banner: 'ca-app-pub-6869992474017983/4806197152', interstitial: 'ca-app-pub-6869992474017983/7563979554' }; } else { admobid = { // windows phone banner: 'ca-app-pub-6869992474017983/8878394753', interstitial: 'ca-app-pub-6869992474017983/1355127956' }; } function initapp() { if (admob) { admob.createbanner({ adid : admobid.banner, position : admob.ad_position.bottom_center, autoshow : true }); } } document.addeventlistener('deviceready', initapp, false);
<body onload="initapp()"> bla bla bla bla <body>
where error , how can display ads @ bottom of page ??
first, run console logs on variables see if exist. can use chrome inspect see console if plug phone in.
second, make sure it's @ least 24 hours since set admob instance @ google. find nothing works @ least 24 hours , bang - it's working.
Comments
Post a Comment