- Home /
Admob interstitial ad show one time and not showing again
This is the code admob interstitial ad show only once what is wrong in this script
using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;
public class AdmobScript : MonoBehaviour
{
InterstitialAd interstitial;
// Use this for initialization
void Start()
{
//Request Ads
RequestBanner();
RequestInterstitial();
}
public void showInterstitialAd()
{
//Show Ad
if (interstitial.IsLoaded())
{
interstitial.Show();
}
}
private void RequestBanner()
{
#if UNITY_EDITOR
string adUnitId = "unused";
#elif UNITY_ANDROID
string adUnitId = "ca-app-pub-4697579006360442/5518347117";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_BANNER_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Create a 320x50 banner at the bottom of the screen.
BannerView bannerView = new BannerView(adUnitId, AdSize.Banner, AdPosition.Bottom);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the banner with the request.
bannerView.LoadAd(request);
}
private void RequestInterstitial()
{
#if UNITY_ANDROID
string adUnitId = "ca-app-pub-4697579006360442/1613571751";
#elif UNITY_IPHONE
string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
#else
string adUnitId = "unexpected_platform";
#endif
// Initialize an InterstitialAd.
interstitial = new InterstitialAd(adUnitId);
// Create an empty ad request.
AdRequest request = new AdRequest.Builder().Build();
// Load the interstitial with the request.
interstitial.LoadAd(request);
}
}
Comment
Are you making sure to request new ads after you show one that way it loads more?
Answer by bhdesignx · Mar 18, 2019 at 12:27 PM
showing ad and request ad again.
void ad ()
{
Admanager.instance.ShowFullScreenAd();
Admanager.instance.RequestFullScreenAd();
}