Question by
Sottnik · Apr 06, 2017 at 09:55 PM ·
scripting problemadsadmob
Admob Interstiate doesn't show
Hello everyone, I have got one problem I am trying to display interstiate ad but it doesn't want to show on my mobile, however in console it says it shows. using GoogleMobileAds.Api;
public class AdController : MonoBehaviour {
public static AdController Instance { set; get; }
InterstitialAd interstitial;
// Use this for initialization
void Start () {
RequestBanner();
RequestInterstitial();
ShowInterstitial();
Instance = this;
DontDestroyOnLoad(gameObject);
}
// Update is called once per frame
void Update () {
}
public void RequestBanner()
{
#if UNITY_EDITOR
string adUnitId = "unused";
#elif UNITY_ANDROID
string adUnitId = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the top of the screen.
BannerView 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);
}
public void RequestInterstitial()
{
#if UNITY_ANDROID
string adUnitId = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ";
#endif
interstitial = new InterstitialAd(adUnitId);
AdRequest request = new AdRequest.Builder().Build();
interstitial.LoadAd(request);
}
public void ShowInterstitial()
{
if (interstitial.IsLoaded())
{
interstitial.Show();
RequestInterstitial();
}
else
{
RequestInterstitial();
}
}
}
console.png
(39.5 kB)
Comment
do you have the log from your mobile device? what platform are you testing on ?
Your answer
Follow this Question
Related Questions
Admob Errors 1 Answer
Admob setup 0 Answers
Admob Banner Has Shown Only Twice in Two Weeks 0 Answers
Need help/guide on how to show AdMob interstitial ads 0 Answers
How to create a remove ads in app purchase for unity android game? 1 Answer