[Bug] Unity 5.5.1 - Android not showing ad & rebooting (Works fine in Editor)

EDIT: Forgot to mention that I’m using UnityAds from the Assets Store

Hi everyone,

I’ve been trying to test UnityAds with my mobile. I’ve managed to make it work with an emulated android that came packed with Xamarin (Android 6.0), however whenever I try with a real mobile it doesn’t show the ad and reboots the game.

The mobile I’m testing is a Samsung Gran Prime which comes with an Android 5.0.2. I’ve tried with both Unity 5.5.1f and 5.5.1p versions.

From the logcat I noticed that there are 2 main points that I think gives us some hints whenever I start the Advertisement class:

  • Failed to ensure directory: /storage/extSdCard/Android/data/com.Pandora.ShallowAbyss/cache

  • Attempted to unregister already unregistered input channel ‘1f45a3b3 com.Pandora.ShallowAbyss/com.unity3d.player.UnityPlayerActivity (server)’
    08-16 21:29:44.709: W/ActivityManager(998): Force removing ActivityRecord{3877ca7e u0 com.Pandora.ShallowAbyss/com.unity3d.ads.adunit.AdUnitActivity t3026}: app died, no saved state
    08-16 21:29:44.709: I/WindowState(998): WIN DEATH: Window{26c2108a u0 com.Pandora.ShallowAbyss/com.unity3d.ads.adunit.AdUnitActivity}

Has anyone ever experienced this?

Code below and log attached:

using System.Collections;
using UnityEngine;
using UnityEngine.Advertisements;
using UnityEngine.UI;

namespace Assets.Scripts.Managers.Ads
{
    public class AdsManager : MonoBehaviour
    {
        public Text debugText1;
        public Text debugText2;

        [SerializeField]
        string gameId = "1487925";

        public void InitializeAd()
        {
            Advertisement.Initialize(gameId, true);

            StartCoroutine(ShowAdWhenReady());
        }

        private void Update()
        {
            debugText1.text = Advertisement.isInitialized.ToString();
            debugText2.text = Advertisement.IsReady().ToString();
        }
        IEnumerator ShowAdWhenReady()
        {
            while (!Advertisement.IsReady())
                yield return null;

            Advertisement.Show();
        }
    }
}

3186305–243175–unityads_log_samsung_5_0_2.txt (5.4 KB)

I think you’ll find this issue is this: “Advertisement.Show” restarts my game, which is a nasty situation for any developers who want to play our games :frowning:

1 Like

Oh that’s it xD I saw that post before, but didn’t think that could be the problem. It’s indeed a problem considering developers . I guess that what we can do is to warn then after Splashscreens :stuck_out_tongue: Thanks a lot Larku!

1 Like