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();
}
}
}