Mobile

Google admob ads with ionic android app

I spent many hours to implement google admob ads with ionic with no luck, I found many tutorial but none of them worked and finally after googling a lot i found one plugin which worked for me. Of course this wasnt also easy, i had to read all the documentation and go through their codes to find out how exactly it works and then finally i saw a small banner at the bottom.
I am sharing my code with you all so when you try to implement admob ads with ionic you dont have to struggle. Lets take a look at the code. Before starting this i assume that you already have a google admob account publisher id, If you dont have, you can create one here.

Install google admob plugin

To use with Ionic Framework, use one of the following command lines:

OR

 

Include admob js file in index.html

You shall find angular-admob.js file inside plugins folder at plugins\com.admob.google\www

Call body onload funtion

And finally create banner code.

Dont forget to change ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII with your publisher id provided by google admob

To download the APK file, Right click on download demo button and then click on “Save link as” and click “Save”

Index.html CodeDownload demo APK

 

More resources here

https://github.com/appfeel/admob-google-cordova/wiki/Setup
https://github.com/appfeel/admob-google-cordova/wiki
https://github.com/floatinghotpot/cordova-admob-pro
https://github.com/appfeel/admob-google-cordova

2 Comments

  • well done. I did the same as you, read the all documents. and finally it ends here.

    If you could set it up in $ionicPlatform.ready it would be great.

Leave a Comment

*

Notify me of followup comments via e-mail. You can also subscribe without commenting.

Shares

Let your friends know what are you reading

Share this post with your friends!