How to get this admob plugin to work

I am trying to add this admob plugin in my ionic app but i can’t really find a step by step guide to get it work.

Have someone ever successfuly used this plugin?

please help me if possible.

Did you wrap your plugin call with deviceready event?

1 Like

I tried it like this in app.js after i added plugin with cordova plugin add

$ionicPlatform.ready(function() {

          adId: 'ca-app-pub-6869992474017983/4806197152',
          isTesting: true


but i get

Uncaught ReferenceError: $cordovaAdMobPro is not defined

First off its $cordovaAdMob not $cordovaAdMobPro

Are you injecting $cordovaAdMob into your .run or .controller?


Thank you all for your reply. i managed to get it work. here is how i processed for developers facing same problem.

I started dig into the ionic project plugin file (assets/www/cordova_plugins.js) and find out i could access the plugin by calling window.AdMob inside my app.js

NOTE : i only used it for the android platform, therefore it’ll only work with android platform but i think it’s easy to add ios and windowsphone support.

i simply added the following code to my app.js inside a deviceReady event Listener the code is from the official AdMob Pro Cordova plugin

the code is inside the .config(function($cordovaAppRateProvider, $ionicConfigProvider, $stateProvider, $urlRouterProvider) {....

here is the code

    document.addEventListener("deviceready", function () {
        admobid = {
            banner: 'ca-app-pub-XXXXXXXXXXXXXX/XXXXXXXXX',
            interstitial: 'ca-app-pub-XXXXXXXXXXXX/XXXXXXXXXXXX'

        window.AdMob.createBanner( {
            adId: admobid.banner,
            position: window.AdMob.AD_POSITION.BOTTOM_CENTER,
            autoShow: true } );

        window.AdMob.prepareInterstitial( {adId:admobid.interstitial, autoShow:false} );

    }, false);

with this i get the banner and the interstitial ads work perfectly in my app. It’s not as much as elegant i would like but it works.

Thank U all.

1 Like

I follow step by step but stick in step two.
error whenionic plugin add

D:\GitHub\ionic2Banner>ionic plugin add
Error: Registry returned 404 for GET on