我是你提到的插件的作者:https://github.com/floatinghotpot/cordova-plugin-admob
基础版已弃用,推荐专业版:https://github.com/floatinghotpot/cordova-admob-pro
您可以考虑使用 Cordova 将您的 html5 游戏打包为混合 APP,然后发布到 Apple AppStore 或 Google Play Store,而不是将 AdMob 移植到移动网络。
使用 AdMob 插件在您的应用中展示广告,然后 Google 会向您付款。
只需几行 javascript 代码即可展示广告,AdMob SDK 将负责广告展示和用户点击。
查看示例代码:
function onLoad() {
if(( /(ipad|iphone|ipod|android|windows phone)/i.test(navigator.userAgent) )) {
document.addEventListener('deviceready', initApp, false);
} else {
initApp();
}
}
var admobid = {};
if( /(android)/i.test(navigator.userAgent) ) {
admobid = { // for Android
banner: 'ca-app-pub-6869992474017983/9375997553',
interstitial: 'ca-app-pub-6869992474017983/1657046752'
};
} else if(/(ipod|iphone|ipad)/i.test(navigator.userAgent)) {
admobid = { // for iOS
banner: 'ca-app-pub-6869992474017983/4806197152',
interstitial: 'ca-app-pub-6869992474017983/7563979554'
};
} else {
admobid = { // for Windows Phone
banner: 'ca-app-pub-6869992474017983/8878394753',
interstitial: 'ca-app-pub-6869992474017983/1355127956'
};
}
// it will display smart banner at top center, using the default options
if(AdMob) AdMob.createBanner( {
adId: admobid.banner,
position: AdMob.AD_POSITION.TOP_CENTER,
autoShow: true } );