Hi. I have a problem with Admob. I'm trying to add banner ad in my unity project. In editor, I get "Dummy LoadAd" message on console. However, when I build the project and install my android devices, ads not appearing. My script are below: using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; public class Script : MonoBehaviour { // Use this for initialization void Start() { showBannerAd(); } private void showBannerAd() { string adID = "ca-app-pub-4751616916843066/1619794527"; //***For Testing in the Device*** AdRequest request = new AdRequest.Builder() .AddTestDevice("406328D9316F2877465487ACED46AB78") .Build(); // request.RequestBannerAd(true); //***For Production When Submit App*** //AdRequest request = new AdRequest.Builder().Build(); BannerView bannerAd = new BannerView(adID, AdSize.SmartBanner, AdPosition.Top); bannerAd.LoadAd(request); } // Update is called once per frame void Update() { } } I installed tools, extras and all sdk platforms from Android SDK Manager. I tried to click Resolve Client Jars but it didn't solve the problem. I'm using 5.6.4f1 version of Unity. How can I solve this problem? Thanks.
Here is my setup that is working.. This is my first time doing it so i'm no expert. Code (csharp): public class AdController : MonoBehaviour { const string ADMOB_APP_ID = ...; const string AD_UNIT_ID = ...; const string AD_UNIT_TEST_ID = ...; const string ADMOD_APP_TEST_ID = ...; private BannerView bannerView; public void Start() { MobileAds.Initialize(AD_UNIT_TEST_ID); this.RequestBanner(); } private void RequestBanner() { // Create a 320x50 banner at the bottom of the screen. bannerView = new BannerView(AD_UNIT_TEST_ID, AdSize.Banner, AdPosition.Bottom); // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the banner with the request. bannerView.LoadAd(request); } public void Cleanup() { bannerView.Destroy(); } } It looks like you might be missing a "MobileAds.Initialize()" with your Ad Id.
Thanks for reply. But problem is not solved. I tried your scripts too, but the result is same. I'm getting Dummy .ctor Dummy CreateBannerView Dummy LoadAd Dummy Initialize logs, but still ads not displaying when I build the application. Can android sdk cause that problem?
Ok First use this script for Testing with interstitial if it work with it then make change to show banner anyway this is the script ! using UnityEngine; using GoogleMobileAds.Api; using GoogleMobileAds; public class AdmobManager : MonoBehaviour { private InterstitialAd interstitial; string AppId = "your App ID"; void Start() { MobileAds.Initialize(AppId); RequestInterstitial(); } public void RequestInterstitial() { #if UNITY_ANDROID string adUnitId = "Your interstitial ID for android"; #elif UNITY_IPHONE string adUnitId = "Your interstitial ID for IOS"; #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); } public void GameOver() { if (interstitial.IsLoaded()) { interstitial.Show(); } } } Step 2 : Make sure to call the game GameOver() function in your game after player death for exemple Step 3 : Make sure to have All those logs on the console Dummy .ctor Dummy Initialize Dummy .ctor Dummy CreateInterstitialAd Dummy LoadAd Dummy IsLoaded Dummy ShowInterstitial if you get all of this and ads still not showing (wich was my case) : - Make sure that your SDK tools on the android studio are Updated - then you have to use those setting on your Player Build Setting (it took me 3 weeks to find this T.T)
Hey there! If anyone is still looking for help I spent 4 hours trying to fix it and all it took was one line. The AdMob documentation was simply missing "this.bannerView.Show();" you may need to delay it however to make sure the add has loaded.
ARGH man I thought this would've fixed my problem but it didn't. I put the bannerView.Show() call after all my other code, after the "bannerView.loadAd(request)" line, as well as in my "HandleOnAdLoaded" event handler method. DANG IT. Well thanks for your reply anyway man.
Okay, I've found some solution : If you still can't see your test-ads , go to Assets -> External Dependency Manager -> Android Resolver -> Force Resolve. If you have an error during resolving (like I did), read what it says and do what you need to do : In my example I need to go to Project Settings -> Player -> Publishing Settings and under Build section check Custom Base Gradle Template. Remeber that you need to wait a little bit - your test ad needs some time to load. Hope that it'll help, if not, keep searching! Edit : Checked if call of Show() method is needed (Banner, test ad) - it's not. Pretty weird, because it exists, but admob documentation doesn't mention it...
in my case test ads are showing properly but real ads are not showing. Now It's been 7+ days I've created those ads and I'm not getting ad filled. so I created house ads but those are also not getting filled. Ad requests are 0. that's weird If my implementation is correct then why ad request is not reaching to admob
Hi guys , I had the same problem the testing ads were displayed , but real ads were not displayed . In this case , go to ad mob account and verify your ad mob account . To verify your account go to dashboard and click on payments and configure it . After your ad mob account will be verified by google your ads will be served / displayed .
I faced the same issue and turns out my admob account payment was not set. So all I did is setup payments and on admob payment page, allowed the cookies and then payment was setup.
Any luck? My admob account is linked to the app in play store, status "ready", added in the real ad unit ID, test ad showing in unity, waited a week... result: no real ads