1

我在使用 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>
4

2 回答 2

1

查看AdMob 插件的文档,更具体地说,您需要此功能来使用您的自定义设置创建横幅:

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 可以使用并根据您的特定设置展示广告。

于 2015-02-06T01:20:17.757 回答
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);
于 2016-04-30T10:51:11.327 回答