Advertisement is not showing on a device.

In Unity Editor there are blue screen in place where my ad should be: “Here would be your Ad unit (things seems to be working”.
What I did:

  • added code related to ad to my scripts (with the same app ID as in Unity Ad service),
  • entered link to GooglePlay app page in Unity Ad Service,
  • forced test mode OFF.

But if I install APK on a device - there are no ad screen (both with debugging mode and with signed APK).
In Unity Ad Service: I checked my app ID, entered link to google play page with my game. Did I miss something, some step (should I do something on AdMob site, or interact with some advertiser) ?
See screenshots with Ad Service settings below.
That’s my code related with ad:

void Start()
{
    Advertisement.Initialize ("1040540", true);
   ...
}

    public void Exit()
    {
        StartCoroutine(ShowAd());
        SceneManager.LoadScene ("SelectionMenu");
        ....
    }

    IEnumerator ShowAd()
    {
        while (!Advertisement.IsReady ())
        {
            yield return null;
        }
        Advertisement.Show();
    }



When are you calling Exit() method? Immediately after startup, or when first scene has ended?

When user exits from a level. It’s a method for Exit button.

Can I add advertisement another way ? May be old way - before Unity Ad Service appeared.

Sorry for delay. Works without problems here on my Android device, when using your example code.

Have you tried without the use of Coroutines in this case? If the ad isn’t ready for whatever reason (connectivity, ads disabled on device etc), you would end up in a situation where you just loop forever, or have the Ad shown on some random time later on.

In this case I would suggest that you just use a normal non-coroutine method, and in case ad isn’t available just ignore it. Makes sense?

-Rasmus

Without coroutines things are the same (also tried to uncheck unknown sources on Android).
If it’s possible that it can not work with my device/region…, may I ask you to install my app from GooglePlay and check the ad (on a real device or AVD) ?
https://play.google.com/store/apps/details?id=com.IndAndroidDev.AsteroidExterminator&hl=en

Why does your game require access to storage? Most recent versions of Ads SDK for Android at least doesn’t require this permission.

Which version of Unity/Unity Ads SDK are you using? In case you are not using latest version, can you upgrade it?

-Rasmus

I use latest versions. In player settings, install location: I selected auto (I think that’s why it asks this permission), do you want me to change it (or how about I’ll sent you development build apk) ?

Please define “latest versions”. Which Unity version, and are you using Ads from Asset Store or enabled using Services Window in Unity 5.2 and above?

Don’t think “Install location” should give the app access to local storage.

-Rasmus

Unity 5.3.2f1, using Services window

Something is not correct here. Can you report a bug using the “Help → Report a bug” menu item from Unity with your project attached and post the bug id here (not the full url)?

-Rasmus

Bug ID: 773792

Today I tried to create test app and don’t understand why ad is not working at all in it, even in editor.

2527829–175344–TestApp.zip (490 KB)

Seems you are trying to show ad immediately after Advertisement.Initialize() call? Could you try something like the following, to see if ads is being shown?
And use of Update() here is only for the example purpose, you should put this logic somewhere else.

using UnityEngine;
using UnityEngine.Advertisements;

public class NewBehaviourScript : MonoBehaviour
{
    bool adsHasBeenShown = false;

    void Start ()
    {
        Advertisement.Initialize ("<gameid>", true);
    }

    void Update()
    {
        if (!adsHasBeenShown && Advertisement.IsReady ())
        {
            adsHasBeenShown = true;
            Advertisement.Show ();
        }
    }
}

Now ad works in editor after I put .Show() in button’s method. But on a real device still no ad screen. Used development build.
May be I missing something, as I understand I should do these steps (for testing):

  • create new ad in my page on Unity Ad Service;
  • put Initialize() and Show() in some script with ad ID from Ad Service;
  • check editor shows blue screens for ad;
  • create APK in debug mode, install it;

After that I should see ad, right ?

Yes, that should work. Did you also verify Advertisement.IsReady() before showing .Call() ?

And if you are using the built-in version of Unity Ads in editor, you don’t need to call Initialize(), as this is done automatically by the engine.

Yes, verified, removed Initialize(), nothing changes.

I have the same issue: Ads working on iOS, but not on Android.
On iOS, the ads work perfectly and tested on 3 devices.
The same project on Android with test mode enabled works in the editor and on the device.
But no ads are showing on any Android devices tested to when testmode is disabled.

Best advice is to look at device logs in this case. If you set http://docs.unity3d.com/ScriptReference/Advertisements.Advertisement-debugLevel.html to Debug, you should be able to see the response from our servers. In case that doesn’t give you a clear idea of why no ads are shown, please write here again.

Thanks,
Rasmus

Hi, Rasmus

Thank you for your response on a Sunday.

How would I implement debugLevel in the script? Can you give me an example?

Is it:
Advertisement.debugLevel = Advertisement.debugLevel.Debug ??