Admob for Android


#1

Hi all, I have a problem with admob plugin. What I do is add the plugin:
plugin add cordova-ionic admob
and include the script in my index.html:
<Script src = "lib / angular-admob / angular-admob.js"> </ script>
And
angular.module(‘starter’, [‘ionic’])

.run(function($ionicPlatform) {
  $ionicPlatform.ready(function() {

    admobSvcProvider.setOptions({
    publisherId:          "ca-app-pub-4373434307752006/7615457157",  // Required
    interstitialAdId:     "ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII",  // Optional
  });
  admobSvc.createBannerView();
  $rootScope.$on(admobSvc.events.onAdOpened, function onAdOpened(evt, e) {
    console.log('adOpened: type of ad:' + e.adType);
  });

    if(window.cordova && window.cordova.plugins.Keyboard) {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);

      // Don't remove this line unless you know what you are doing. It stops the viewport
      // from snapping when text inputs are focused. Ionic handles this internally for
      // a much nicer keyboard experience.
      cordova.plugins.Keyboard.disableScroll(true);
    }
    if(window.StatusBar) {
      StatusBar.styleDefault();
    }
  });
})

But it does not work, when imported into Eclipse throws me errors. Any ideas?


#2

Why not use:

Just add the plugin and it should add the required files automatically.