Created
March 17, 2018 00:45
-
-
Save rtroe/93f133f232ebe42ddad4b0f6ea668a21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <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