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();
}
}
}
![alt text][1]
[1]: /storage/temp/91531-console.png
↧