Search Unity

Admob Banner Not Working! Getting Crazy With This!

Discussion in 'Editor & General Support' started by zerobruga, Apr 15, 2019.

  1. zerobruga

    zerobruga

    Joined:
    Mar 17, 2019
    Posts:
    4
    Hi there!

    I got a game released on the Play Store but I'm not being able to set up a banner correctly.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using GoogleMobileAds.Api;
    5. public class GoogleMobileAdsDemoScript : MonoBehaviour
    6. {
    7.     private BannerView bannerView;
    8.     public void Start()
    9.     {
    10. #if UNITY_ANDROID
    11.         string appId = "ca-app-pub-XXX";
    12. #elif UNITY_IPHONE
    13.             string appId = "ca-app-pub-XXX";
    14. #else
    15.             string appId = "ca-app-pub-XXX";
    16. #endif
    17.         // Initialize the Google Mobile Ads SDK.
    18.         MobileAds.Initialize(appId);
    19.         this.RequestBanner();
    20.     }
    21.     private void RequestBanner()
    22.     {
    23. #if UNITY_ANDROID
    24.         string adUnitId = "ca-app-pub-XXX";
    25. #elif UNITY_IPHONE
    26.             string adUnitId = "ca-app-pub-XXX";
    27. #else
    28.             string adUnitId = "ca-app-pub-XXX";
    29. #endif
    30.         // Create a 320x50 banner at the top of the screen.
    31.    
    32.         bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom);
    33.         AdRequest request = new AdRequest.Builder().Build();
    34.         bannerView.LoadAd(request);
    35.     }
    36. }
    This is my code, is exactly the same as the Tutorial on the main website, and it's attached to the main camera. I don't see anything in the Unity Editor or Android device...
    I need help please!