Intertitial ad not showing in live device (but working while testing it in Unity)
Hello guys,
I've been trying to implement ads to my game these last week, I had not problem with banners, they're working correctly both in Unity and on my Android phone, but I can't get intertitials working at all. They work perfectly while testing the game in Unity (I call them after the player dies 8 times). But when trying the game on a device the ad doesn't show at all.
Any ideas?
This is where I call the intertitial:
if (num_death > 7)
{
AdManager.GetComponent<Admob>().ShowIntersitial();
PlayerPrefs.SetInt("num_death", 0);
}
else
{
AdManager.GetComponent<Admob>().ShowBanner();
}
The request is made during Start:
// Start is called before the first frame update
void Start()
{
#if UNITY_ANDROID
string appId = app_ID; //your admob app id
#elif UNITY_IPHONE
string appId = "ca-app-pub-3940256099942544~1458002511";
#else
string appId = "unexpected_platform";
#endif
if(remove_ads == false)
{
// Initialize the Google Mobile Ads SDK.
MobileAds.Initialize(appId);
RequestInterstitial();
RequestBanner();
//RequestRewardedAd();
}
}
And finally both Request and Show codes for the ad:
public void RequestInterstitial()
{
#if UNITY_ANDROID
string adUnitId = interstitial_ad_ID; //ca-app-pub-3940256099942544/1033173712test
#elif UNITY_IPHONE
string adUnitId = "ca-app-pub-3940256099942544/4411468910";
#else
string adUnitId = "unexpected_platform";
#endif
// Initialize an 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);
}
//show intersitial
public void ShowIntersitial()
{
if (remove_ads == false)
{
if (interstitial.IsLoaded())
{
interstitial.Show();
}
else
{
Debug.Log("AD NOT LOADED");
}
}
}
I'm calling a function when the player clicks the "next level/retry" button that destroys all the ads:
public void DestroyAllAds()
{
if (remove_ads == false)
{
if (interstitial.IsLoaded())
{
interstitial.Destroy();
}
if (bannerView != null)
{
bannerView.Destroy();
}
}
}
Comment