Google admob ads with ionic android app

<!DOCTYPE html>
<html>
  <head>
	<meta charset="utf-8">
	<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
	<title></title>

	<link href="lib/ionic/css/ionic.css" rel="stylesheet">
	<link href="css/style.css" rel="stylesheet">

	<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
	<link href="css/ionic.app.css" rel="stylesheet">
	-->

	<!-- ionic/angularjs js -->
	<script src="lib/ionic/js/ionic.bundle.js"></script>

	<!-- cordova script (this will be a 404 during development) -->
	<script src="cordova.js"></script>

	<script src="js/angular-admob.js"></script>

	<!-- your app's js -->
	<script src="js/app.js"></script>
  </head>
  <body ng-app="starter" onload="runads()">

	<ion-pane>
	  <ion-header-bar class="bar-stable">
		<h1 class="title">Ionic Blank Starter</h1>
	  </ion-header-bar>
	  <ion-content>
	  </ion-content>
	</ion-pane>
  </body>
</html>
<script type="text/javascript">
  function runads(){
	document.addEventListener("deviceready", onDeviceReady, false);
  }

  function initAds() {
	if (admob) {
	  var adPublisherIds = {
		ios : {
		  banner : "ca-app-pub-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII"
		},
		android : {
		  banner : "ca-app-pub-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII",
		  interstitial : "ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII"
		}
	  };

	  var admobid = (/(android)/i.test(navigator.userAgent)) ? adPublisherIds.android : adPublisherIds.ios;

	  admob.setOptions({
		publisherId:      admobid.banner,
		interstitialAdId: admobid.interstitial,
		tappxIdiOs:       "/XXXXXXXXX/Pub-XXXX-iOS-IIII",
		tappxIdAndroid:   "/XXXXXXXXX/Pub-XXXX-Android-AAAA",
		tappxShare:       0.5
	  });

	  registerAdEvents();

	} else {
	  alert('AdMobAds plugin not ready');
	}
  }

  function onAdLoaded(e) {
	if (e.adType === admob.AD_TYPE.INTERSTITIAL) {
	  admob.showInterstitialAd();
	  showNextInterstitial = setTimeout(function() {
		admob.requestInterstitialAd();
	  }, 2 * 60 * 1000); // 2 minutes
	}
  }

  // optional, in case respond to events
  function registerAdEvents() {
	document.addEventListener(admob.events.onAdLoaded, onAdLoaded);
	document.addEventListener(admob.events.onAdFailedToLoad, function (e) {});
	document.addEventListener(admob.events.onAdOpened, function (e) {});
	document.addEventListener(admob.events.onAdClosed, function (e) {});
	document.addEventListener(admob.events.onAdLeftApplication, function (e) {});
	document.addEventListener(admob.events.onInAppPurchaseRequested, function (e) {});
  }

  function onDeviceReady() {
	document.removeEventListener('deviceready', onDeviceReady, false);
	initAds();

	// display a banner at startup
	admob.createBannerView();

	// request an interstitial
	admob.requestInterstitialAd();
  }

</script>