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

Unity Google AdMob Banner

$
0
0
Hello! I've been following Google's Unity AdMob guide at this website: https://developers.google.com/admob/unity/start I've been trying to implement a banner ad type to an Android game. I imported the provided package and also used the Play Service Android Resolver in order to include the Mobile Android SDK. The problem is that all the Ads work properly except the banner. In the position where the banner is supposed to be the UI elements like buttons do not work, they are blocked by something on top of them, so it seems like the banner is there, however not visible. I have tested this on 2 different Android devices and the result was the same. Here is the code that I am using: using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; using GoogleMobileAds; public class adMobBannerScript : MonoBehaviour { private BannerView bannerView; public void Start () { #if UNITY_ANDROID string appId = "Hidden"; #elif UNITY_IPHONE string appId = "Hidden"; #else string appId = "unexpected_platform"; #endif MobileAds.Initialize (appId); this.RequestBanner (); } private 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 if (bannerView != null) { bannerView.Destroy(); } bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Top); // Create an empty ad request. AdRequest request = new AdRequest.Builder ().Build (); // Load the banner with the request. bannerView.LoadAd (request); } public void destroyBanner() { bannerView.Destroy (); } } And here is the unity log when I run the code: ![alt text][1] Thank you very much for your time! [1]: /storage/temp/118474-log.jpg

Viewing all articles
Browse latest Browse all 1416

Trending Articles



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