PhoneGap Build admob

时间:2015-02-05 22:26:52

标签: cordova phonegap-plugins phonegap-build phonegap-pushplugin phonegap-admob

我有关于phonegap构建的问题,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>

2 个答案:

答案 0 :(得分:1)

检查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已准备好使用并显示具有您特定设置的广告。

答案 1 :(得分:0)

回复您关于如何在游戏开始时展示广告的评论,并在此处使用插件: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);