AdMob ads

The AdMob plugin can show ads from the AdMob ad service.

AdMob is currently only officially supported with the Intel® XDK. However it should also be supported by PhoneGap CLI with the com.cranberrygame.phonegap.plugin.ad.admob plugin, and on PhoneGap Build in future.

Setting up

To get started with the plugin, follow these steps:

  1. Go to www.admob.com and sign up an account. (This is free)
  2. Once logged in, create Ad Unit IDs for the ad types you want to use
  3. Add the AdMob object to your Construct 2 project
  4. In the AdMob object's properties, copy and paste in the relevant Ad Unit IDs from your account
  5. Now you can add actions to show ads in your game.

Exporting

Remember to set the Test mode property to No before publishing.

Currently only Crosswalk is supported via the Android export option. Once your project is open in the Intel® XDK, follow these steps:

  1. Go to the 'Projects' tab (in the top-left)
  2. Under 'CORDOVA 3.X HYBRID MOBILE APP SETTINGS', click 'Plugins and Permissions'
  3. Click 'Third Party Plugins'
  4. Click 'Get Plugin from the Web'
  5. Enter the following details:

Name: AdMob Plugin
Plugin ID: com.cranberrygame.phonegap.plugin.ad.admob
Check the 'Plugin is located in the Apache Cordova Plugins Registry' box

Then click 'Import'.

Now your XDK project can support AdMob Ads. The above steps must be done for every XDK project you wish to use AdMob Ads with.

AdMob properties

Overlap
Whether banner ads should overlap the game, or reduce the game viewport size to fit the ad alongside.

Test Mode
Display ads for testing use only. Be sure to set to No before publishing.

Banner ID / Interstitial ID (for various platforms)
Paste in the Ad Unit IDs from your AdMob account in to these properties.

AdMob conditions

Is showing banner ad
True if currently displaying a banner ad.

Is showing interstitial
True if currently displaying an interstitial ad.

On banner ad received
Triggered after Preload banner ad when the ad has been downloaded and is ready to be displayed.

On interstitial dismissed
Triggered when an interstitial ad is closed.

On interstitial presented
Triggered when an interstitial ad is first displayed.

On interstitial received
Triggered after Preload interstitial when the ad has been downloaded and is ready to be displayed.

AdMob actions

Hide banner ad
Hide any currently showing banner ad.

Preload banner ad
Start downloading a banner ad. When it is ready, On banner ad received is triggered, and then the ad can be displayed without any delay.

Preload interstitial
Start downloading an interstitial ad. When it is ready, On interstitial received is triggered, and then the ad can be displayed without any delay.

Reload banner ad
Reload a currently showing banner ad, replacing it with a different one.

Reload interstitial
Reload a currently showing interstitial ad, replacing it with a different one.

Show banner ad
Show a banner ad at a given position and size.

Show interstitial
Show an interstitial ad which has been preloaded. Alternatively if nothing has been preloaded, it will download an interstitial and then show it when ready.

AdMob expressions

The AdMob object has no expressions.

Tags: