Question by
k3lvjn2702 · Dec 14, 2017 at 01:32 PM ·
adsadmobadvertising
Admob banner not showing on device
I have interstitial Ad and banner Ad of admob but only interstitial showing on device. Here is my code: using System.Collections; using System.Collections.Generic; using UnityEngine; using GoogleMobileAds.Api; using System; public class AdManager : MonoBehaviour { public static AdManager _instace { get; private set; } public InterstitialAd interstitialAd; public BannerView bannerView;
public string fullAdId;
public string bannerAdId;
private void Awake()
{
_instace = this;
}
private void Start()
{
RequestFullAd();
RequestBanner();
ShowBanner();
}
private void Update()
{
}
public void RequestFullAd()
{
#if UNITY_ANDROID
fullAdId = "ca-app-pub-1314772933868241/9487526372";
#endif
#if UNITY_IPHONE
fullAdId = "ca-app-pub-1314772933868241/2894197867";
#endif
interstitialAd = new InterstitialAd(fullAdId);
AdRequest request = new AdRequest.Builder().Build();
interstitialAd.LoadAd(request);
}
public void ShowFullAd()
{
interstitialAd.Show();
}
public void RequestBanner()
{
#if UNITY_ANDROID
bannerAdId = "ca-app-pub-1314772933868241/2664035212";
#endif
#if UNITY_IPHONE
bannerAdId = "ca-app-pub-1314772933868241/5233366841";
#endif
bannerView = new BannerView(bannerAdId,AdSize.Banner,AdPosition.Top);
AdRequest request = new AdRequest.Builder().Build();
bannerView.LoadAd(request);
bannerView.OnAdLoaded += HandleOnLoaded;
}
void HandleOnLoaded(object a,EventArgs args)
{
bannerView.Show();
}
public void ShowBanner()
{
bannerView.Show();
}
}
Comment
Your answer
Follow this Question
Related Questions
Error, platform-specific implementation not set // AdColony Unity 0 Answers
How to make an Ad Repeat after 5minutes iOS 0 Answers
Destroy an Object through rewarded video. 0 Answers
Google Admob not showing interstitial ads on apk build 0 Answers
Admob new rewarded video api causing a memory leak?,Admob new rewarded ad api causing a memory leak 0 Answers