- Home /
Unity Admob not showing production ads [SOLVED]
Hello,
I have been searching all over the interweb for a solution, but cannot find any. So I decided to try my luck here and see if anyone can help me fix my issue.
I am using AdMob in Unity and got all of the Test Ads working perfectly. When I switched to the production appId and adUnitId, the banners and ads no longer load.
I built it to my Android, I also loaded it as a BETA app release on Google Play. I do not understand why I am not getting any ads.
This is my code:
 using UnityEngine;
 using GooglePlayGames.BasicApi;
 using GooglePlayGames;
 using GoogleMobileAds.Api;
 using System;
 
 public class GoogleServicesHandler : MonoBehaviour
 {
     public GameController gameController;
     public static GoogleServicesHandler instance;
     private bool signedIn => Social.localUser.authenticated;
     private bool useLocalLeaderboard;
     private BannerView bannerView;
     private RewardBasedVideoAd rewardBasedVideo;
     private string iosLeaderboardId = "TopPlayerScoresiOS";
 
 
     private void Start()
     {
         if (!signedIn)
         {
             //Check if the device can reach the internet via a carrier data network or wifi
             if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork ||
                 Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
             {
 #if UNITY_ANDROID
                 PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder().Build();
 
                 PlayGamesPlatform.InitializeInstance(config);
                 PlayGamesPlatform.DebugLogEnabled = true;
                 PlayGamesPlatform.Activate();
                 SignIn();
             }
         }
         string appId = "ca-app-pub-2650981032277620~4922009643";
 #elif UNITY_IPHONE
         if (!signedIn)
         {
             //Check if the device can reach the internet via a carrier data network or wifi
             if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork ||
                 Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork)
             {
                 SignIn();
             }
         }
         string appId = "ca-app-pub-2650981032277620~8515151556";
             //Do gamecenter stuff here.
 #endif
         MobileAds.Initialize(appId);
         rewardBasedVideo = RewardBasedVideoAd.Instance;
         // Called when the user earns reward for watching entire video.
         rewardBasedVideo.OnAdRewarded += HandleRewardBasedVideoRewarded;
         // Called when the ad is closed.
         rewardBasedVideo.OnAdClosed += HandleRewardBasedVideoClosed;
     }
     
 
     private void SignIn()
     {
         Social.localUser.Authenticate(success => { Debug.Log("Login success: " + success); });
     }
 
     public void RequestRewardBasedVideo()
     {
 #if UNITY_ANDROID
         string adUnitId = "ca-app-pub-2650981032277620/6349643906";
 #elif UNITY_IPHONE
             string adUnitId = "ca-app-pub-2650981032277620/6732787280";
 #else
             string adUnitId = "unexpected_platform";
 #endif
 
         // Create an empty ad request.
         AdRequest request = new AdRequest.Builder().Build();
         // Load the rewarded video ad with the request.
         rewardBasedVideo.LoadAd(request, adUnitId);
     }
 
     public void UserOptToWatchAd()
     {
         if (rewardBasedVideo.IsLoaded())
         {
             rewardBasedVideo.Show();
         }
     }
 
     public void HandleRewardBasedVideoClosed(object sender, EventArgs args)
     {
         print("Requesting video ad");
         RequestRewardBasedVideo();
     }
 
     public void HandleRewardBasedVideoRewarded(object sender, Reward e)
     {
         gameController.score = gameController.score * 2;
         gameController.GameOver();
     }
 
 
 
 
     public void RequestBanner()
     {
         print("Requesting Banner Ad");
 #if UNITY_ANDROID
         string adUnitId = "ca-app-pub-2650981032277620/6912203574";
 #elif UNITY_IPHONE
                 string adUnitId = "ca-app-pub-2650981032277620/8870374778";
 #else
                 string adUnitId = "unexpected_platform";
 #endif
 
         // Create a 320x50 banner at the top of the screen.
         bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Bottom);
 
         // Create an empty ad request.
         AdRequest request = new AdRequest.Builder().Build();
 
         // Load the banner with the request.
         bannerView.LoadAd(request);
     }
 
     public void DestroyAd()
     {
         bannerView.Destroy();
     }
 
     public void UnlockAchievement(string id)
     {
         if (signedIn)
         {
             Social.ReportProgress(id, 100, (bool success) => { });
         }
     }
 
     public void ShowAchievementsUI()
     {
         if (signedIn)
         {
             Social.ShowAchievementsUI();
         }
     }
 
     public void SendScoreToLeaderboards(long score)
     {
         if (signedIn)
         {
 #if UNITY_ANDROID
             Social.ReportScore(score, "CgkI0IuFrcsLEAIQAQ", success => { });
 #elif UNITY_IOS
             Social.ReportScore(score, iosLeaderboardId, success => { });
 #endif
         }
     }
 
     public void ShowLeaderboardsUI()
     {
         if (signedIn)
         {
             Social.ShowLeaderboardUI();
         }
     }
 }
I also forced resolve and it resolves android dependencies successfully.
What am I missing or doing wrong?
Answer by augivision · Feb 25, 2019 at 03:23 AM
OK, so all I had to do was wait a little bit for AdMob to fill the ad-space. [SOLVED!]
Did you have to publish it on the play store first?
What do you mean but waiting a little bit? Like, a few more seconds in the phone for the ad to load, or a few days for the Ad$$anonymous$$ob account to be ready?
I see the requests in my Ad$$anonymous$$ob panel but I don't see the ads in my mobile.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                