• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Android Interstitial ads(ADMOB)GM2

3jgamesdev

Member
Hi Good day,

I have been following this ARTICLE but i always get the error, when im doing the testing my game force close in my phone,this is what i have done

I made an object for ads i name it, obj_ads
obj_ads
Room Start:

Code:
if os_type == os_android
    {
    app_id = "ca-app-pub-8945688549689911~xxxxxxx";
    banner_id = "ca-app-pub-4337965814269841/xxxxxxx";
    interstitial_id = "ca-app-pub-8945688549689911/xxxxxxx";
    rewarded_id = "ca-app-pub-4337965814269841/xxxxxxx";
    }

GoogleMobileAds_Init(ads_interstitial, ads_app_id);
GoogleMobileAds_LoadInterstitial();
interstitial_loaded = false;
Step event:
Code:
if GoogleMobileAds_InterstitialStatus() == "Ready"
        {
        if interstitial_loaded != true
            {
            interstitial_loaded = true;
            }
        }
Social:
Code:
var _id = async_load[? "id"];
    if _id == GoogleMobileAds_ASyncEvent
    {
    var ident = async_load[? "type"];
    switch (ident)
        {
        case "interstitial_load":
            if async_load[? "loaded"] == 1
                {
                interstitial_loaded = true;
                }
            break;
        }
    }

then i have this button when the character gets game over
Code:
if interstitial_loaded == true
    {
    interstitial_loaded = false;
    GoogleMobileAds_ShowInterstitial();
    }
room_restart();
I dont know where i went wrong, I have check the internet permission

Please Help thanks
 
Last edited:
T

The Shatner

Guest
Well... I don't really use the Social Async event, and it works normally.

I don't know what's wrong with your code since I don't use the same method, but here goes my method:

First object created, GAME START event:
Code:
GoogleMobileAds_Init("ca-app-pub-xxxxxxxxx/xxxxxxxx","ca-app-pub-xxxxxxxxx~xxxxxxx");
var deviceID = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
GoogleMobileAds_UseTestAds( true, deviceID );
Then I have an object that loads the interstitial ad while the player is enjoying the game:
obj_interstitial (or whatever you want to call it) CREATE EVENT:
Code:
    GoogleMobileAds_LoadInterstitial();
    var deviceID = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; //yes, I repeat this code
    GoogleMobileAds_UseTestAds( true, deviceID ); //and this one
obj_interstitial STEP EVENT:
Code:
if (global.Showad == true) { //assuming you switch this var to TRUE when you want the ad to be shown
            if (GoogleMobileAds_InterstitialStatus() == "Ready") {
                GoogleMobileAds_ShowInterstitial();
            }
        }
So far, It's worked pretty well.
 
Top