PhoneGap Build admob
问题描述:
我有phonegap构建问题,admob不显示...我如何显示它?PhoneGap Build admob
这是我的JS文件
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/jquery-2.0.3.min.js"></script>
<script type="text/javascript" src="js/createjs-2013.09.25.min.js"></script>
<script type="text/javascript" src="js/main.js"></script>
<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="js/sounds.js"></script>
<script type="text/javascript" src="js/admob.js"></script>
这是开始游戏我的主要功能。
<script>
$(document).ready(function(){
var oMain = new CMain({
min_reel_loop:2,
reel_delay: 6,
time_show_win:2000,
time_show_all_wins: 2000,
money:3000
});
$(oMain).on("game_start", function(evt) {
//alert("game_start");
});
$(oMain).on("end_bet", function(evt,iMoney,iBetWin) {
//alert("iMoney: "+iMoney + " Win:"+iBetWin);
});
$(oMain).on("restart", function(evt) {
//alert("restart");
});
});
</script>
答
检查documentation of the AdMob plugin,更具体地说,你需要这个功能与您的自定义设置创建横幅:
window.plugins.AdMob.setOptions({
publisherId: admobid.banner,
interstitialAdId: admobid.interstitial,
bannerAtTop: false, // set to true, to put banner at top
overlap: false, // set to true, to allow banner overlap webview
offsetTopBar: false, // set to true to avoid ios7 status bar overlap
isTesting: false, // receiving test ad
autoShow: true // auto show interstitial ad when loaded
});
的index.html我的例子链接即可使用,并显示与广告的具体设置。
答
回应您的评论有关如何在游戏开始时显示广告,并在这里使用插件:https://github.com/appfeel/admob-google-cordova你应该这样做:
function onDeviceReady() {
document.removeEventListener('deviceready', onDeviceReady, false);
// Set AdMobAds options:
admob.setOptions({
publisherId: "ca-app-pub-XXXXXXXXXXXXXXXX/BBBBBBBBBB", // Required
interstitialAdId: "ca-app-pub-XXXXXXXXXXXXXXXX/IIIIIIIIII", // Optional
});
// Start showing banners (atomatic when autoShowBanner is set to true)
admob.createBannerView();
}
document.addEventListener("deviceready", onDeviceReady, false);
删除cordova.js或phonegap.js,你不应该既不使用,也只使用其中之一。并添加一个链接到你正在使用的插件,其中有很多。 – jcesarmobile 2015-02-06 07:15:34
好吧,我刚刚删除phonegap.js,但我想在我的主要js功能集成时,开始游戏节目横幅。 – wpcard 2015-02-06 10:38:46
链接到您正在使用的插件? – jcesarmobile 2015-02-06 10:43:14