Skip to content

Instantly share code, notes, and snippets.

@rtroe
Created March 17, 2018 00:45
Show Gist options
  • Save rtroe/93f133f232ebe42ddad4b0f6ea668a21 to your computer and use it in GitHub Desktop.
Save rtroe/93f133f232ebe42ddad4b0f6ea668a21 to your computer and use it in GitHub Desktop.
/// <summary>
/// Shows the initersial ad if there's one loaded.
/// </summary>
public void ShowInitersialAd()
{
#if __ANDROID__
if (mInterstitialAd.IsLoaded)
{
mInterstitialAd.Show();
}
#elif __IOS__
Console.WriteLine("AdViewInterstitial.IsReady:" + AdViewInterstitial.IsReady);
try
{
if (AdViewInterstitial != null)
{
if (AdViewInterstitial.IsReady)
{
UIViewController viewController = Game.Services.GetService(typeof(UIViewController)) as UIViewController;
AdViewInterstitial.PresentFromRootViewController(viewController);
}
}
}
catch
{
Console.WriteLine("Error Showing Ad");
}
#endif
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment