Admob and Unity ads not showing in my game
Hi Everyone.
I have published my game called bird killer with AdMob ads and using interstitials and rewarded video ads and after publishing, I came to know that my ads are not working my interstitials sometime show up but on maximum time do not show up and rewarded video is not showing even single time and rewarded video showing is important i my game because I have a life system and when life is finished you can get by watching rewarded videos but rewarded videos are not working.
now after 2 days of battling and still not working so, I used unity ads but they also don't show up i am stuck in it.
what I have done till now.
I am using Google Mobile Ads Unity Plugin v3.16 and tried in v3.0.0 and many more.
Added app id in android manifest.
Unity Ads are on in unity.
my code of ads manager is below
using UnityEngine; using System.Collections; using GoogleMobileAds; using GoogleMobileAds.Api; using System; //using admob; using UnityEngine.Advertisements; public class AdsManager : MonoBehaviour { private InterstitialAd interstitial; private RewardedAd rewardedAd; // Admob ad; string appId = "ca-app-pub-2931825634126153~1092346741"; string InterstitialadUnitId = "ca-app-pub-2931825634126153/3845081715"; public static bool Is_Live_Button; public static bool AdnotavailablePanal; // Use this for initialization void Awake() { Advertisement.Initialize("3091031"); MobileAds.Initialize(appId); this.RequestRewardBasedVideo(); AdnotavailablePanal = false; DontDestroyOnLoad(this.gameObject); RequestInterstitial(); StartCoroutine(rewarededvideo()); StartCoroutine(Interstial()); StartCoroutine(Ini()); } void Start() { ShowInterstital(); } private void RequestRewardBasedVideo() { string RewardedadUnitId = "ca-app-pub-2931825634126153/5278293320"; this.rewardedAd = new RewardedAd(RewardedadUnitId); // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); this.rewardedAd.LoadAd(request); } public void RequestInterstitial() { this.interstitial = new InterstitialAd(InterstitialadUnitId); AdRequest request = new AdRequest.Builder().Build(); this.interstitial.LoadAd(request); this.interstitial.OnAdFailedToLoad += HandleOnAdFailedToLoad; this.interstitial.OnAdClosed += HandleOnAdClosed; } public void ShowInterstital() { if (this.interstitial.IsLoaded()) { RequestInterstitial(); this.interstitial.Show(); } else { RequestInterstitial(); StartCoroutine(Interstial()); } } private void HandleOnAdClosed(object sender, EventArgs e) { RequestInterstitial(); } private void HandleOnAdFailedToLoad(object sender, AdFailedToLoadEventArgs e) { RequestInterstitial(); } public void ShowRewardedWatchAd() { if (Advertisement.IsReady("rewardedVideo")) { GiveRewardForGamePaly(); Advertisement.Show("rewardedVideo"); } else if (rewardedAd.IsLoaded()) { rewardedAd.Show(); GiveRewardForGamePaly(); } else { // AdnotavailablePanal.SetActive(true); AdnotavailablePanal = true; RequestRewardBasedVideo(); StartCoroutine(rewarededvideo()); } } public void ShowRewardedWatchAdForLive() { if (Advertisement.IsReady("rewardedVideo")) { Is_Live_Button = true; GiveRewardForMain(); Advertisement.Show("rewardedVideo"); } else if (rewardedAd.IsLoaded()) { rewardedAd.Show(); Is_Live_Button = true; GiveRewardForMain(); } else { // AdnotavailablePanal.SetActive(true); AdnotavailablePanal = true; RequestRewardBasedVideo(); StartCoroutine(rewarededvideo()); } } public void ShowRewardedWatchAdForCash() { if (Advertisement.IsReady("rewardedVideo")) { Advertisement.Show("rewardedVideo"); GiveRewardForMain(); } else if (rewardedAd.IsLoaded()) { rewardedAd.Show(); GiveRewardForMain(); } else { // AdnotavailablePanal.SetActive(true); AdnotavailablePanal = true; RequestRewardBasedVideo(); StartCoroutine(rewarededvideo()); } } public void GiveRewardForMain() { if (Is_Live_Button) { Debug.Log("Live"); PlayerPrefs.SetInt("Live", PlayerPrefs.GetInt("Live") + 1); Is_Live_Button = false; } else { Debug.Log("Cash"); PlayerPrefs.SetInt("cash", PlayerPrefs.GetInt("cash") + 500); } } public void GiveRewardForGamePaly() { Debug.Log("i am in"); PlayerPrefs.SetInt("Live", PlayerPrefs.GetInt("Live") + 1); Application.LoadLevel("Loading"); } public void RestartScene() { Application.LoadLevel("Loading"); } IEnumerator rewarededvideo() { yield return new WaitForSeconds(0.1f); if (!rewardedAd.IsLoaded()) { RequestRewardBasedVideo(); } else { StartCoroutine(rewarededvideo()); } } IEnumerator Interstial() { yield return new WaitForSeconds(0.1f); if (!this.interstitial.IsLoaded()) { RequestInterstitial(); } StartCoroutine(Interstial()); } IEnumerator Ini() { yield return new WaitForSeconds(0.1f); if (!Advertisement.isInitialized) { Advertisement.Initialize("3091031"); } StartCoroutine(Ini()); } }
I am calling StartCoroutine(Ini()); because unity does not Initialize automatically. I am calling StartCoroutine(Interstial()); to make sure ads is ready to show every time. I am calling StartCoroutine(rewarededvideo()); to make sure rewarded video is ready to show every time. I am using Unity 5.3.6f1
I am stuck in this problem from days now any help can be much applicated. Thanks In advance.
Answer by yennefer4568 · Apr 06, 2019 at 12:47 PM
in my game app;
Admob Ads doesn't show when im using the real Ad Id, but using test AdId it show up
Answer by Senkrigar · Sep 18, 2019 at 04:36 PM
Hello, I'm having the same problem here, did you manage to make it work ?