by Jon (Updated on 2016-10-08)
Although Android supports many ad networks, we've chosen to support AdMob, which is owned and operated by Google itself. Through 3rd-party extensions, Stencyl supports a number of other ad networks.
This guide is for Stencyl build 9279 and higher
Before you can test ads, in your game, you must set up an account with AdMob.
Now that you've set up an account with AdMob, you can test out ads in your game.
Before you publish your game to the store, you want to know if the ads are working. Google does not allow you to click on live ads when testing your game so you have to set Admob in Testmode.
Note: Don't forget to disable Test Ads when your are ready to Publish your game, or else the test ads will show up.
Note: Use this block only once a session as early as possible(Like in a loading scene)
Take note of your AdMob Banner Ad unit ID as mentioned above in step 6. Als called Publisher key on Stencyl Monetization page
Open your game in Stencyl. Under Settings > Mobile > Monetization.
To display an ad, you must tell the ad to show. This is done using the show/hide ad block (under Game > Mobile). If you've read our iOS Ads guide, you'll notice that this is the same block.
Note: All the blocks that apply to iOS Ads also apply to Android Ads.
Ad Position is set in the Initialize block using the dropdown. You can choose between Top or Bottom positioning. If you want to change the position on runtime use the
Take note of your AdMob Interstitial Ad unit ID as mentioned above in step 6. Als called Publisher key on Stencyl Monetization page
Open your game in Stencyl. Under Settings > Mobile > Monetization.
Before you can show the Interstitial ad, you have to load them first. (Its take a couple of seconds to load an ad). You have to load the ad every after it's showed up.
For example:
Load the ad when player click the start play button
Sometimes, it's useful to know when an ad has been clicked on or dismissed, so that you can provide a smooth transition between viewing the ad and resuming the game. Stencyl provides the following events for ads.
These events can be found under the Mobile > Ads item under the Add Event dropdown.
Event | Description |
---|---|
An banner ad is showing | The banner ad is showing on screen |
An banner ad is closed | User closes the banner ad |
The banner ad area loads | Called each time a banner ad loads |
The banner ad area fails to load | Called when no banner ads can be loaded |
An banner ad is clicked | User clicks on the banner ad |
Tip: We recommend pausing the game when an ad is clicked on and resuming it when the ad is dismissed. If you don't do this, the game will continue to run while the ad is overlayed over everything else.
Event | Description |
---|---|
An fullscreen ad is showing | The Interstitial ad is showing on screen |
An fullscreen ad is closed | User closes the Interstitial ad |
The fullscreen ad area loads | Called each time a Interstitial ad loads |
The fullscreen ad area fails to load | Called when no Interstitial ads can be loaded |
An fullscreen ad is clicked | User clicks on the Interstitial ad |
Tip: We recommend pausing the game when an ad is clicked on and resuming it when the ad is dismissed. If you don't do this, the game will continue to run while the ad is overlayed over everything else.
Officially, Stencyl only supports AdMob on Android. Through free, user-created extensions, other ad networks besides AdMob are supported. These include...
Check out our Extensions Market and Extensions Forum for more details.
As of late 2016, we're using v9.4 of Google play Services Library (SDK)
When ads are displayed, they will cover up a small part of the screen. You should avoid displaying crucial game elements under an ad, such as HUD elements.
The height of mobile ad block (under Game > Mobile) provides the height, so you can lay your game out accordingly.