Search Unity

Admob banner invisible but clickable (also test one). Interstitial and Rewarded video OK!

Discussion in 'Unity Ads & User Acquisition' started by Vaitor, Nov 13, 2019.

  1. Vaitor

    Vaitor

    Joined:
    May 15, 2014
    Posts:
    11
    I'm creating a litter game for android with Unity (2019.2.11f1) with sdk download from Hub.
    Using GoogleMobileAds-v4.1.0.

    The problema is that Admob banners don't show. They are there because are clickable. I tried either with test and none test. Sometimes when unlocking the phone I see the banner, but return invisible in a second.
    In the other hand, Interstitial and RewardedVideo works fine.

    private BannerView bannerView;
    void Start() {
    Debug.Log("start admob");
    #if UNITY_ANDROID
    string appId = "ca-app-pub-3940256099942544~3347511713";
    #elif UNITY_IPHONE
    string appId = "ca-app-pub-3940256099942544~1458002511";
    #else
    string appId = "unexpected_platform";
    #endif
    // Initialize the Google Mobile Ads SDK.
    MobileAds.Initialize(appId);
    RequestBanner();
    }

    public void RequestBanner() {
    #if UNITY_ANDROID
    string adUnitId = "ca-app-pub-3940256099942544/6300978111"
    #elif UNITY_IPHONE
    string adUnitId = "ca-app-pub-3940256099942544/2934735716"
    #else
    string adUnitId = "unexpected_platform";
    #endif

    bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Bottom);
    //AdRequest request = new AdRequest.Builder().Build();
    AdRequest request = new AdRequest.Builder().AddTestDevice(test_device).Build();

    // Load the banner with the request.
    bannerView.LoadAd(request);
    }

    public void HideBanner() {
    //bannerView.Hide();
    bannerView.Destroy();
    }

    public void ShowBanner() {
    if (bannerView != null) {
    bannerView.Show();
    } else {
    RequestBanner();
    }
    }

    I also tried with appid test, destroying de banner instead of hiding, requesting banner manually and not at the start, diferent positions, different dimensions, removing all gameobject around...

    In android logcat don't see an error. I pasted the logs when I click the button to show it:
    11/13 11:54:14.200 21061 21061 Debug AdsUnity: Calling show() on Android
    11/13 11:54:48.709 21061 21061 Info Ads: This request is sent from a test device.
    11/13 11:54:48.734 21061 21312 Info AudioManager: In isSpeakerphoneOn(), calling application: com.VictorVelez.MergerMotoBike
    11/13 11:54:49.812 21061 21061 Info DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
    11/13 11:54:49.812 21061 21061 Info DynamiteModule: Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
    11/13 11:54:49.871 21061 21061 Warn Ads: #004 The webview is destroyed. Ignoring action.
    11/13 11:54:49.878 21061 21061 Info chatty: uid=10066(com.VictorVelez.MergerMotoBike) identical 1 line
    11/13 11:54:49.878 21061 21061 Warn Ads: #004 The webview is destroyed. Ignoring action.
    11/13 11:54:49.927 21061 21061 Debug AdsUnity: Calling show() on Android
    11/13 11:54:49.936 21061 21340 Info Unity: HandleAdLoaded event received
    11/13 11:54:49.936 21061 21340 Info Unity: UnityEngine.DebugLogHandler:Internal_Log(LogType, LogOption, String, Object)
    11/13 11:54:49.936 21061 21340 Info Unity: UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
    11/13 11:54:49.936 21061 21340 Info Unity: UnityEngine.Logger:Log(LogType, Object)
    11/13 11:54:49.936 21061 21340 Info Unity: UnityEngine.Debug:Log(Object)
    11/13 11:54:49.936 21061 21340 Info Unity: GoogleMobileAdsScript:HandleOnAdLoadedBanner(Object, EventArgs) (at C:\Users\Victor\Documents\Trabajo\Merger Moto Bike\Assets\Scenes\Scripts\GoogleMobileAdsScript.cs:101)
    11/13 11:54:49.936 21061 21340 Info Unity: GoogleMobileAds.Api.BannerView:<ConfigureBannerEvents>b__26_0(Object, EventArgs) (at C:\Users\Victor\Documents\Trabajo\Merger Moto Bike\Assets\GoogleMobileAds\Api\BannerView.cs:108)
    11/13 11:54:49.936 21061 21340 Info Unity: GoogleMobileAds.Android.BannerClient:eek:nAdLoaded() (at C:\Users\Victor\Documents\Trabajo\Merger Moto Bike\Assets\GoogleMobileAds\Platforms\Android\BannerClient.cs:124)
    11/13 11:54:49.936 21061 21340 Info Unity: System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
    11/13 11:54:49.936 21061 21340 Info Unity: System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
    11/13 11:54:49.936 21061 21340 Info Unity: System.Reflection.MethodBase:Invoke(Object, Object[])
    11/13 11:54:49.936 21061 21340 Info Unity: UnityEngine.AndroidJavaProxy:Invoke(
    11/13 11:54:49.994 21061 21061 Warn Ads: #004 The webview is destroyed. Ignoring action.
    11/13 11:54:49.994 21061 21061 Warn Ads: #004 The webview is destroyed. Ignoring action.


    I'm really exausted. I have no more ideas..

    Thanks in advance
    Víctor