I want to display AdMob ads on my mobile app. I have built my app using HTMl5, CSS3 and Javascript with PhoneGap build using the cordova plugin. Can someone link me to steps on how to display ads on my mobile app ? Is there a better Ads solution than Admob that i can try ?
PLease Note i cannot make any changes to Java files since i using PhoneGap Build to build my app.
AdMob plugin was not available in PhoneGap Build before, as the old policy did not allow binary files submitted.
But now, they made a great change to their policy (http://phonegap.com/blog/2014/12/09/phonegap-build-new-features/), and now allow you to use the plugins in Cordova plugin registry.
To use Admob plugin in your app, just configure it in your config.xml:
<gap:plugin name="com.google.cordova.admob" version="2.5.0" source="plugins.cordova.io" />
The instruction and example code are documented at its github project homepage:
https://github.com/floatinghotpot/cordova-admob-pro
to display a banner Ad:
if(AdMob) AdMob.createBanner( {
adId:admobid.banner,
position:AdMob.AD_POSITION.BOTTOM_CENTER,
autoShow:true} );
to display a full screen Ad:
// preppare and load ad resource in background, e.g. at begining of game level
if(AdMob) AdMob.prepareInterstitial( {adId:admobid.interstitial, autoShow:false} );
// show the interstitial later, e.g. at end of game level
if(AdMob) AdMob.showInterstitial();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With