Hi all. In my android/iphone game, I'm trying to display admob ads. I followed the tutorial here: http://wewritecode.com/2014/04/13/setting-admob-android-ios-unity/ When I run the code in Unity, I get the following in the console: Created DummyClient Dummy CreateBannerView Dummy LoadAd As far as I can tell, that suggests it's working properly, but no ads actually display in the game window. When I compile it to run on Android, it runs fine, but still no ads display. I've attached the ad script to my camera controller, as the tutorial said I should, and my code is as follows: Code (CSharp): using System; using UnityEngine; using GoogleMobileAds; using GoogleMobileAds.Api; // Example script showing how to invoke the Google Mobile Ads Unity plugin. public class GoogleMobileAdsDemoScript : MonoBehaviour { private BannerView bannerView; private InterstitialAd interstitial; private void Start() { Debug.Log ("Starting Ads Plugin"); #if UNITY_EDITOR string adUnitId = "unused"; #elif UNITY_ANDROID string adUnitId = "ca-app-pub-1585816329662741/6947689119"; #elif UNITY_IPHONE string adUnitId = "ca-app-pub-1585816329662741/9621953912"; #else string adUnitId = "unexpected_platform"; #endif // Create a 320x50 banner at the bottom of the screen. bannerView = new BannerView("ca-app-pub-1585816329662741/6947689119", AdSize.SmartBanner, AdPosition.Bottom); // Register for ad events. bannerView.AdLoaded += HandleAdLoaded; bannerView.AdFailedToLoad += HandleAdFailedToLoad; bannerView.AdOpened += HandleAdOpened; bannerView.AdClosing += HandleAdClosing; bannerView.AdClosed += HandleAdClosed; bannerView.AdLeftApplication += HandleAdLeftApplication; // Load a banner ad. bannerView.LoadAd(createAdRequest()); } private void RequestInterstitial() { #if UNITY_EDITOR string adUnitId = "unused"; #elif UNITY_ANDROID string adUnitId = "INSERT_ANDROID_INTERSTITIAL_AD_UNIT_ID_HERE"; #elif UNITY_IPHONE string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE"; #else string adUnitId = "unexpected_platform"; #endif // Create an interstitial. interstitial = new InterstitialAd(adUnitId); // Register for ad events. interstitial.AdLoaded += HandleInterstitialLoaded; interstitial.AdFailedToLoad += HandleInterstitialFailedToLoad; interstitial.AdOpened += HandleInterstitialOpened; interstitial.AdClosing += HandleInterstitialClosing; interstitial.AdClosed += HandleInterstitialClosed; interstitial.AdLeftApplication += HandleInterstitialLeftApplication; // Load an interstitial ad. interstitial.LoadAd(createAdRequest()); } // Returns an ad request with custom ad targeting. private AdRequest createAdRequest() { Debug.Log ("Creating Ad Request"); return new AdRequest.Builder() .AddTestDevice(AdRequest.TestDeviceSimulator) .Build(); } private void ShowInterstitial() { if (interstitial.IsLoaded()) { interstitial.Show(); } else { print("Interstitial is not ready yet."); } } #region Banner callback handlers public void HandleAdLoaded(object sender, EventArgs args) { print("HandleAdLoaded event received."); } public void HandleAdFailedToLoad(object sender, AdFailedToLoadEventArgs args) { print("HandleFailedToReceiveAd event received with message: " + args.Message); } public void HandleAdOpened(object sender, EventArgs args) { print("HandleAdOpened event received"); } void HandleAdClosing(object sender, EventArgs args) { print("HandleAdClosing event received"); } public void HandleAdClosed(object sender, EventArgs args) { print("HandleAdClosed event received"); } public void HandleAdLeftApplication(object sender, EventArgs args) { print("HandleAdLeftApplication event received"); } #endregion #region Interstitial callback handlers public void HandleInterstitialLoaded(object sender, EventArgs args) { print("HandleInterstitialLoaded event received."); } public void HandleInterstitialFailedToLoad(object sender, AdFailedToLoadEventArgs args) { print("HandleInterstitialFailedToLoad event received with message: " + args.Message); } public void HandleInterstitialOpened(object sender, EventArgs args) { print("HandleInterstitialOpened event received"); } void HandleInterstitialClosing(object sender, EventArgs args) { print("HandleInterstitialClosing event received"); } public void HandleInterstitialClosed(object sender, EventArgs args) { print("HandleInterstitialClosed event received"); } public void HandleInterstitialLeftApplication(object sender, EventArgs args) { print("HandleInterstitialLeftApplication event received"); } #endregion } So, what am I doing wrong?
have you tested it on an actual android device ? from the log above i assume you ran it in the editor
I ran it in the editor, as well as on an Android emulator, two Samsung Note 4's, and a couple of Android phones. The ads work on none of them.
The admob plugin by VNTIS apparently only works for Android, and not for iPhone. We're releasing for both systems. I suppose I can use that plugin for a month or so while we're finalizing the company setup so we can get our iOS dev license, but we will need a complete solution to the problem by then...
Checked out the VNTIS's AdMob plugin. It seemed to have the same issue. I'm not sure what's going on there.... The ads just don't display.
Hate to resurrect an old thread, but I am having the exact same issue. I have scoured information online trying to solve this and nothing works. I have tried every combination of manifest.xml arrangements I can think of and nothing will make ads show on my devices. They appear to load fine in the Unity player though, by the same logic you used ("Dummy show interstitial", etc.). Did you ever find a solution to this?
here is a complete package to implement in your game https://www.assetstore.unity3d.com/en/#!/content/90443 try it
Seeing as no one has clearly answered this question... When testing any ads you need to get the .apk onto the device, then install, then open the app on the device. You cannot test ads with the Unity emulator. Additionally if you are TESTING an ad you need to build a test advertisement and assign your testing device ID, build the following AdRequest: Code (CSharp): request = new AdRequest.Builder() .AddTestDevice(AdRequest.TestDeviceSimulator) // Simulator. .AddTestDevice(SystemInfo.deviceUniqueIdentifier) // My test device. .Build(); SystemInfo.deviceUniqueIdentifier returns your devices unique 'Device Id'. Also, when defining the Banner (or any test Ad) use the testing ID's provided by the Google Doc @ Sample Ad Units example: Code (CSharp): bannerView = new BannerView([B]sample_ad_unit_[/B], AdSize.SmartBanner, AdPosition.Top); If you are running a live ad keep in mind that AdMob can take 24 hours to link your ap to their servers. So if you filled out your AdMob account with your Ap details you probably will not see any live ads until the next day. And remember... DO NOT, click your own live ads, its a good way to get your AdMob account banned. You can click test ads when testing.
hey i have a similar problem ,on the console i got the same output but app doesnt open in android studio.
You will not see even TestAds if you only recently made an appId for your google admob? So you'll have to wait 24 hours? I followed the instructions as I could, added the test device info for the AdRequest builder but it still doesn't work.
I have the same problem, I did everything there is to fre, but nothing does not break the ads on smartphones android... help
Hi,If test ads are working there is no problem with your ads integration .At present admob ads shows within 24-48 hrs (i mean real ads) Previously they used to show within 10 minutes after integration .I suggest you to generate signed copy of apk and try it on real device.They are not showing real ads when debugged.This is my recent findings
It happened to me recently, my problem was that I forgot to call Initialize "MobileAds.Initialize()", maybe that would help
I'm getting the same thing, no ads showing and those "Dummy .ctor/Dummy CreateBannerView/Dummy LoadAd" prints in the Unity Console. I've followed the Google Developers tutorial as well as a YouTube video from AwesomeTuts (basically follows the Google Dev documentation). No ads show in either Unity when hitting Play or when installing the apk on my phone. I have the device set for test ads shown in the following code (which is in the Start method for an empty GameObject named AdManager). Code (CSharp): MobileAds.Initialize(initStatus => { }); string adUnitId = @"ca-app-pub-3940256099942544/6300978111"; // test ID // create a 320x50 banner at the top of the screen bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top); // I also have the OnAdXYZ event handlers assigned here but they just write to Console using Debug.Log AdRequest request = new AdRequest.Builder() .AddTestDevice(AdRequest.TestDeviceSimulator) .AddTestDevice(SystemInfo.deviceUniqueIdentifier) .Build(); // load the banner with the request bannerView.LoadAd(request); I did sign up for an AdMob account about 24 hours ago so I dunno if that's related. Seems like Test ads should still show though, right?
As an update, in another thread on this topic a guy said he simply solved it by adding "bannerView.Show()" call to the end, as the documentation forgot it apparently. Didn't work for me though. I put the bannerView.Show() call after all my other code, after the "bannerView.LoadAd(request)" line, and that didn't worked. So I also tried putting it in my "HandleOnAdLoaded" event handler method, and no dice there either. I'm hoping it's just because I signed up for AdMob 24 hours ago but I dunno... seems odd.
I wish. I ended up getting an asset that takes care of the AdMob implemention (and other ad systems) itself but I had to revert my project back to a month old backup cause it got all crapped up. So I haven't been able to use that asset yet lol. Hopefully it works though.
I have same problem? Using admob with the easy mobile pro asset. Problem existed before i installed easy mobile, that it why i installed easy mobile to try to fix it. Everything works in android ok. Test ads work perfectly in ios but not real ads. "No ads to show" error. Have tested on real devices. I can see in the admob console that the app has made over 400 requests, not 1 impression. The admob ids were set up months ago. I notice in the admob settings you can provide a url for the app store once it is published. Will that make it work? I dont really want to release it until i am sure ads work. But may be i need to, to link it. Too scary publishing not knowing if your ads work, i have read other posts of users who have published and still have no ads months later. What are we meant to do. Use a different ad network may be?
I just need one person to say, "trust me it will work once published" Then i will release and see and report back here if it worked and how long it took for ads to start running. Someone, anyone? Or any other checks i can do first?
I'm right there with you, @Brad3355 . I've successfully implemented AdMob for Android in 3 games. I've continually had problems with AdMob and iOS though. Last game, there were conflicts with UIWebView being added to the build which prevented XCode from uploading. This current game, everything works fine until I get to running the iOS build on an iPhone. Then, I see this gem of an error: "Invalid Request. Cannot determine request type. Is your ad unit id correct?". The settings in Unity are correct with AdId and AdUnitIds, as evidenced by the live Android version. My app and placements in AdMob are over 48 hours old, but I don't yet have an App Store link. I am wondering the same thing: will putting the app store link in the AdMob console resolve this?
@polyphonic13 Did you test your theory? My Interstitial test add is properly showing in the Unity editor using either button or calling the function in code. But when i build it, suddenly i cant open the add by calling the ShowInterstitial() function in code. Any Ideas?