Quantcast
Channel: Questions in topic: "ads"
Viewing all articles
Browse latest Browse all 1416

AdMob banner ad not showing!

$
0
0
Hello everyone! I need some help. Our game is almost done and one of the last things that are left are adding some ads to it. I've done it before and it works in other of our games. But now the banner ad isn't showing at all! I haven't tried with interstitial ads or rewarded videos yet. It is working in the editor (I'm getting the "Dummy Initialize", "Dummy LoadAd", "Dummy CreateBannerView"), but not on an actual android device. It isn't working with test ads either! First I'm initialising in with the script: using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds; using GoogleMobileAds.Api; public class InitialiseAds : MonoBehaviour { // Use this for initialization void Start () { #if UNITY_ANDROID string appId = "ca-app-ID..."; #elif UNITY_IPHONE string appId = "ca-app-ID..."; #else string appId = "unexpected_platform"; #endif // Initialize the Google Mobile Ads SDK. MobileAds.Initialize(appId); } } and then after that script I'm creating and loading the banner ad through that script: using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds; using GoogleMobileAds.Api; public class BannerScript : MonoBehaviour { private BannerView bannerView; // Use this for initialization void Start () { this.RequestBanner(); } private void RequestBanner() { #if UNITY_ANDROID string adUnitId = "ca-app-pub-unitID"; #elif UNITY_IPHONE string adUnitId = "ca-app-pub-unitID"; #else string adUnitId = "unexpected_platform"; #endif // Create a 320x50 banner at the top of the screen. bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Top); // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the banner with the request. bannerView.LoadAd(request); } } Unity version: 2017.2.0f3 Google AdMob version: 3.10.0 P.S: Sorry about my script looking that bad, I don't know why it is so ugly-looking. Thank you in advance and have a great holidays! :)

Viewing all articles
Browse latest Browse all 1416

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>