- Home /
Admob not working
I am trying to display interstitial ads in my game. I have built the project for iOS and tried to run. I got following message in console;
<Google> To get test ads on this device, call: request.testDevices = @[ @"b9ade3b76dd9d16ccc6c61b78bf7d427" ];
I have entered my device ID in unity code. But still ads won't display. I have followed sample code from GoogleMobileAdsDemoScript
file.
private AdRequest createAdRequest()
{
return new AdRequest.Builder()
.AddTestDevice("device id here")
.AddKeyword("game")
.TagForChildDirectedTreatment(false)
.AddExtra("color_bg", "454545")
.Build();
}
I can't understand what I am doing wrong. I am using Unity 4.5.3. Please help me. Thanks.
This may not be the issue but i thought i'd ask anyway just in case. Are you you showing the ad once it's loaded?
Interstitial ads require you to "show" the ad once loaded, if you are not calling
interstitial.Show();
Then the ad may have loaded but will never be shown to the player.
@froYo thanks for reply. Yes I am calling show function on successful interstitial load callback. But unfortunately, ads couldn't be generated as per above message on console. What can I do for that?
Perhaps just try the basic code to load an interstitial? Then see if there's still a problem.
AdRequest request = new AdRequest.Builder()
.AddTestDevice("device id here")
.Build();
You could also use the admob events to output data to a GUI.Label or something to see if AdLoaded or AdFailedToLoad are producing any messages.
Answer by gMichael · Sep 30, 2014 at 10:37 AM
Hi had the same problem you need a bool variable and move the interstitial.Show(); function in the update area. Now the ad is displayed when it is loaded.
private bool adIsOn;
void Update () {
if (adIsOn != true) {
if (interstitial.IsLoaded()) {
adIsOn = true;
interstitial.Show();
}
}
.......