Search code examples
cordovaphonegap-pluginsphonegap-buildphonegap-pushpluginphonegap-admob

PhoneGap Build admob


I have problems with phonegap build , admob not show... How can i show it?

This is my js file

        <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>

This is my main function that start game.

 <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>

Solution

  • Check the documentation of the AdMob plugin, more specifically, you need this function to create the banner with your custom settings:

    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
    });
    

    The example index.html I linked is ready to use and show ads with your specific settings.