Add ads to your Phonegap app

  • 1
  • Question
  • Updated 6 years ago
  • Doesn't Need an Answer
So I have made an app with Phonegap. It is up on Google Play and is getting downloads.
I would like to add some AdMob ads to a free version. I'm unsure where to start though since I can't open and edit an apk file with Android Studio.
How should I progress?
Photo of Oscar

Oscar

  • 17 Posts
  • 0 Reply Likes

Posted 6 years ago

  • 1
Photo of John Weidner

John Weidner, Champion

  • 435 Posts
  • 80 Reply Likes
You would probably need a plugin to do this. Unfortunately, as discussed here (http://community.phonegap.com/nitobi/...) there are not any plugins that work with PhoneGap Build. This is because PhoneGap Build requires all plugins to be published with source code not binary libraries. So I think you would need to use the command line PhoneGap CLI tools. Here's a discussion of doing that - http://www.codeproject.com/Articles/7....
Photo of Oscar

Oscar

  • 17 Posts
  • 0 Reply Likes
Since I only have two pages in my app do you think it would be possible and legal to use Adsense instead?
Photo of Petra V.

Petra V., Champion

  • 7794 Posts
  • 1391 Reply Likes
Photo of Oscar

Oscar

  • 17 Posts
  • 0 Reply Likes
Oh no...Will have to find a way to use Admob then :)
Photo of Oscar

Oscar

  • 17 Posts
  • 0 Reply Likes
I found this video.
https://www.youtube.com/watch?v=cNXM0...

But Admob seems to have removed that way of adding ads.
Photo of Liming Xie

Liming Xie

  • 23 Posts
  • 6 Reply Likes
Using AdSense in Mobile App is not allowed by Google.

Instead, using Cordova/PhoneGap plugin is a good solution, as it's implemented based on GoogleAds native SDK.

Thanks to PhoneGap Build team for making big changes to the policy, and allow all plugins in Cordova plugin registry can be used.

After 1 year, the long waited popular AdMob plugin can be used by PhoneGap Build users, by simply configuring it in config.xml:

The javascript call is quite simple, as the purpose of the plugin is: # Show Mobile Ad with single line of javascript code #

if(AdMob) AdMob.createBanner( {
adId:"ca-app-pub-xxx/kkk", // your admob ad unit id
position:AdMob.AD_POSITION.TOP_CENTER,
autoShow:true} );

For more instructions or example code, just go to the github homepage of the plugin project:
https://github.com/floatinghotpot/cor...

This conversation is no longer open for comments or replies.