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

Test Ads Not Showing on Android Device

$
0
0
Hi, so I made a Unity Android game and am trying to put test ads on it. I have a very simple AdMob script, when run in the Editor I get notified that the ad is loaded however when testing the apk on my phone, nothing happens. How can I fix this?

I have an created an Admob app and put in the app ID in the Editor as well.

Thank you

The Code: ![alt text][1] using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; using System; public class Admob : MonoBehaviour { //external references private BannerView bannerView; private void RequestBanner() { #if UNITY_ANDROID string adUnitId = "ca-app-pub-3940256099942544/6300978111"; //test #elif UNITY_IPHONE string adUnitId = "ca-app-pub-3940256099942544/2934735716"; #else string adUnitId = "unexpected_platform"; #endif // Create a 320x50 banner at the top of the screen. bannerView = new BannerView(adUnitId, AdSize.SmartBanner, AdPosition.Bottom); // Create an empty ad request. AdRequest request = new AdRequest.Builder().Build(); // Load the banner with the request. bannerView.LoadAd(request); } // Start is called before the first frame update void Start() { #if UNITY_ANDROID string appId = "ca-app-pub-2432741135954738~7585816177"; //your admob app id #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(); ShowBanner(); } //show banner public void ShowBanner() { bannerView.Show(); } } [1]: /storage/temp/168572-screenshot.png

Viewing all articles
Browse latest Browse all 1416

Trending Articles



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