Jump to content

Phaser + Phonegap - How to get Ad's?


Recommended Posts

I have spend the last 2 days trying to get Ad's working on my HTML5 Phaser JS game.

Im using this plugin:


The plugin is installed as far as I can tell

config.xml has the below:

<feature name="AdMob">    <param name="ios-package" value="CDVAdMobPlugin" />    <param name="onload" value="true" /></feature>

When I run my code in Xcode I get the below, which confirm the plugin is working fine.

2015-06-07 11:22:03.071 Marty[13191:1120217] [CDVTimer][admob] 0.136971ms2015-06-07 11:22:03.071 Marty[13191:1120217] [CDVTimer][TotalPluginStartup] 0.307977ms

I am using the below code in my deviceReady function to start a test banner ad. However, nothing is displayed.

var enabledAdMob = true;    if (enabledAdMob) {      AdMob.createBanner({        adId: "ca-app-pub-XXXXXXXXXXXX?XXXXXXXXX",        position: AdMob.AD_POSITION.TOP_CENTER,        offsetTopBar: true,        isTesting: true,        autoShow: true      });    }

If I use the exact same code and same plugin with a non Phaser JS Phonegap application it works fine and I get this in the console.

2015-06-07 11:28:26.273 appname[13452:1152164] [CDVTimer][admob] 0.143945ms2015-06-07 11:28:26.273 appname[13452:1152164] [CDVTimer][TotalPluginStartup] 93.865991ms2015-06-07 11:28:26.302 appname[13452:1152164] Resetting plugins due to page load.2015-06-07 11:28:26.894 appname[13452:1152164] createBanner2015-06-07 11:28:26.969 appname[13452:1152164] request.testDevices: 9e788a4b970dc9e34b3830c67dcf7f7e, <Google> tips handled2015-06-07 11:28:27.530 appname[13452:1152164] Finished load of: file:///folder/Developer/CoreSimulator/Devices/C900F3B1-2299-493A-BF66-BC97119BBBD8/data/Containers/Bundle/Application/app.app/www/index.html2015-06-07 11:28:27.951 appname[13452:1152164] AdMob, onAdLoaded, {'adNetwork':'AdMob','adType':'banner','adEvent':'onAdLoaded'}2015-06-07 11:28:27.951 appname[13452:1152164] statusbar offset:0.000000, overlap:0, ad position:8, x:0, y:02015-06-07 11:28:27.952 appname[13452:1152164] window, resize, 

And the Ad is visible and working fine.

I have tried many many variations on where I place the createBanner method, however nothing seems to work.

I am desperately in need of assistance from someone who can point me in the right direction.


Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...