# Admob for Android

**URL:** <https://forum.ionicframework.com/t/admob-for-android/46423>\
**Category:** ionic-v1\
**Created:** [March 15, 2016, 1:07am UTC](https://forum.ionicframework.com/t/admob-for-android/46423 "2016-03-15T01:07:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![frandearma](https://avatars.discourse-cdn.com/v4/letter/f/67e7ee/32.png) [@frandearma](https://forum.ionicframework.com/u/frandearma)\
**Post date:** [March 15, 2016, 1:07am UTC](https://forum.ionicframework.com/t/admob-for-android/46423/1 "2016-03-15T01:07:43Z")

</div>

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?

 ![image](https://global.discourse-cdn.com/ionicframework/original/3X/8/6/86a6b2daf13109a56ed39529ea3a19176670c949.jpg)

---

<div class="post-metadata">

**Author:** ![EffakT](https://avatars.discourse-cdn.com/v4/letter/e/b487fb/32.png) [@EffakT](https://forum.ionicframework.com/u/EffakT)\
**Post date:** [March 15, 2016, 1:42am UTC](https://forum.ionicframework.com/t/admob-for-android/46423/2 "2016-03-15T01:42:59Z")

</div>

Why not use:

> **[floatinghotpot/cordova-admob-pro](https://github.com/floatinghotpot/cordova-admob-pro)**
>
> cordova-admob-pro - :fire: Cordova Plugin for Google AdMob, DFP, ADX. Easy monetization using mobile Ad, with single line of JavaScript. Compatible with Cordova CLI, Inoic, PhoneGap Build, etc.

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