UNPKG

cordova.plugin.admobpro

Version:

Google AdMob plugin for Cordova, Phonegap and Intel XDK ,support ios and android,support admob v1 and admob v2 ,Monetize your app with one javascript line.simple and easy to use api.build on admob ios 7.6 and admob android sdk 8 project home:https

77 lines (74 loc) 3.18 kB
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="format-detection" content="telephone=no" /> <!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 --> <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /> <meta name="msapplication-tap-highlight" content="no" /> <title>banner demo</title> <style> .bodyStyle{ font-size: 32px; } </style> </head> <body > <div class="bodyStyle"> <h1>demo</h1> <lu> <li><a href="javascript:admob.cacheInterstitial();">load Interstitial</a></li> <br/> <li><a href="javascript:showInterstitial();">show Interstitial</a></li> <br/> <li><a href="javascript:showTestBanner();">show test banner</a></li> <br/> <li><a href="javascript:admob.showBannerAbsolute(admob.BannerSize.BANNER,0,70);">banner 1</a></li> <br/> <li><a href="javascript:admob.showBannerAbsolute(admob.BannerSize.BANNER,30,70);">banner 2</a></li> <br/> <li><a href="javascript:admob.showBanner(admob.BannerSize.BANNER,admob.Position.BOTTOM_CENTER,null)">banner 3</a></li> <br/> <li><a href="javascript:admob.showBanner(admob.BannerSize.BANNER,admob.Position.BOTTOM_APP,null)">banner 4</a></li> <br/> <li><a href="javascript:admob.hideBanner()">hide banner</a></li> </lu> </div> <div id="alertdiv"/> <script type="text/javascript" src="cordova.js"></script> <script type="text/javascript"> function showTestBanner(){ var admobParam=new admob.Params(); //admobParam.extra={'keyword':"admob phonegame"}; //admobParam.isForChild=true; admobParam.isTesting=true; admob.showBanner(admob.BannerSize.BANNER,admob.Position.TOP_CENTER,admobParam); } function showInterstitial(){ admob.isInterstitialReady(function(isReady){ if(isReady){ admob.showInterstitial(); } }); } function onInterstitialReceive (message) { alert(message.type+" ,you can show it now"); //admob.showInterstitial();//show it when received } function onReceiveFail (message) { var msg=admob.Error[message.data]; if(msg==undefined){ msg=message.data; } document.getElementById("alertdiv").innerHTML="load fail: "+message.type+" "+msg; } function onDeviceReady() { admob.initAdmob("ca-app-pub-931030468xxxxx/xxxxxxxxxxx","ca-app-pub-93103xxxxxxx/xxxxxxxxxxx"); document.addEventListener(admob.Event.onInterstitialReceive, onInterstitialReceive, false); document.addEventListener(admob.Event.onInterstitialFailedReceive,onReceiveFail, false); document.addEventListener(admob.Event.onBannerFailedReceive,onReceiveFail, false); } document.addEventListener('deviceready',onDeviceReady, false); </script> </body> </html>