ADMob ads no show

I’m having a annoying problem, I’m trying to call the Interstitial Ad after clicking on the home screen button, but an advertisement does not open (I tried right by android and it did not load)
Is there any method missing?

using System.Collections;
using System.Collections.Generic;
using GoogleMobileAds.Api;
using UnityEngine;
using UnityEngine.SceneManagement;

public class comandosBasico : MonoBehaviour {


    public void carregaCena(string nomeCena)
    {

#if UNITY_ANDROID
        string adUnitId = "ca-app-pub-4887096828380218/5757046491";
#elif UNITY_IPHONE
        string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
#else
        string adUnitId = "unexpected_platform";
#endif

        // Initialize an InterstitialAd.
        InterstitialAd interstitial = new InterstitialAd(adUnitId);
        // Create an empty ad request.
        AdRequest request = new AdRequest.Builder().Build();
        // Load the interstitial with the request.
        interstitial.LoadAd(request);

        if (interstitial.IsLoaded())
        {
            interstitial.Show();
        }

        SceneManager.LoadScene(nomeCena);
    }
}

Check on Android Monitor.

I think in android you have to add testdevice of your device which can be seen in android monitor.
Add that testdevice in your script.

Cara não aparece nada :confused:

I’ve got Google Ads working in one of my apps so far. Found this thread while troubleshooting how to get it to work for the other app, so I know how frustrating this can be.

For one thing, at least for testing purposes, you’ll probably want to move the display ad call to a separate function since the interstitialad takes a few seconds to load.

In your example, try moving the following bit to a separate function, and calling it right before you do your scene change:

         if (interstitial.IsLoaded())
         {
             interstitial.Show();
         }
 SceneManager.LoadScene(nomeCena);

The first part of your code can be called somewhere near the start of your application. It is need to initialize everything so it can be called from the Start() function of a script tied to an object somewhere (splash screen or main menu or something similar should work).

Like the previous comment said, you’ll want to use the test ad ID to avoid problems with Google. That ID should be:
adUnitId = “ca-app-pub-3940256099942544/1033173712”;

It tends to load up real quick too, so you’ll know if the code is working or not.

Also, in admob when you set up your ad, make sure it is an interstitial, and that you are using ‘that’ particular adID and not one for a banner, or reward video ad, or any other ads you might have set up.

Hopefully that will work for you.

PS It’s a royal pain, but Google Ads use dummy functions when they see that you are in the Unity editor. So you won’t get any useful information unless you’re debugging on an actual android device, 8^(.