Admob problems in intel xdk -
i hava app want show ads not on index.html on index1.html
everything works great on index.html admob script below, banner , interstitial shows up, dont whant them on index.html, want them on index1.html. delete code index.html , put in index1.html no ads showing up?
why that?
whay want them index1 not user friendly hav interstitial pop 1sec after appstart.
i thinking call interstitial on first button click cant working either.
iam using admob plugin pro (cordova-plugin-admobpro)
in intel xdk
this admobpro script use in html file:
<script type="text/javascript" src="cordova.js"></script> <script>var admobid = {}; if( /(android)/i.test(navigator.useragent) ) { admobid = { // android banner: 'ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', interstitial: 'ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }; } else if(/(ipod|iphone|ipad)/i.test(navigator.useragent)) { admobid = { // ios banner: 'ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', interstitial: 'ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }; } else { admobid = { // windows phone banner: 'ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', interstitial: 'ca-app-pub-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' }; } if(( /(ipad|iphone|ipod|android|windows phone)/i.test(navigator.useragent) )) { document.addeventlistener('deviceready', initapp, false); } else { initapp(); } function initapp() { if (! admob ) { alert( 'admob plugin not ready' ); return; } admob.createbanner( { adid: admobid.banner, istesting: false, overlap: false, offsettopbar: false, position: admob.ad_position.bottom_center, bgcolor: 'black' } ); admob.prepareinterstitial({ adid: admobid.interstitial, autoshow: true }); }</script>
if going build "multi-page" app (multiple html files), need include cordova.js
on each html page accesses javascript extensions provided cordova plugins. in other words, html pages include magic cordova.js
init script can access cordova plugin apis.
in general, multi-page web apps not advised building cordova apps, because of issue , because app experience delays when switching between pages. lose javascript context, can cause logical problems in app.
i recommend rebuild app "single-page" app (aka spa). see this cordova doc article, section titled spa friend!
Comments
Post a Comment