Quantcast
Channel: Questions in topic: "admob"
Viewing all articles
Browse latest Browse all 137

Problem playing AdMob

$
0
0
I'm encountered this issue while playing an AdMob ad banner. The banner ad runs only in the game editing mode in the Unity editor. But when the game is compiled and running on the phone, there is no ad banner. Test mode was turned off. Does anyone know how to fix this? Maybe change Player settings or Preferences or something similar? Who had a similar problem, share your experience. Here is code of integration Admob. **1.**Initalize AdMob: using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; public class InitializeAdMob : MonoBehaviour { private string appId = "ca-app-pub-xxxxxx~xxxx"; public void Start() { // Initialize the Google Mobile Ads SDK. MobileAds.Initialize(appId); } } **2.**Code of show banner AdMob: using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; public class AdsManager : MonoBehaviour { private string appId = "ca-app-pub-xxxx~xx"; public BannerView bannerView; public void Start() { MobileAds.Initialize(appId); this.RequestBanner(); } public void RequestBanner() { string AdUnitId = "ca-app-pub-xxxxxxxxxx/xxxx"; this.bannerView = new BannerView(AdUnitId, AdSize.Banner, AdPosition.Bottom); AdRequest request = new AdRequest.Builder().Build(); this.bannerView.LoadAd(request); } }

Viewing all articles
Browse latest Browse all 137

Trending Articles



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