Created
March 17, 2018 00:42
-
-
Save rtroe/71e73dba1f3d41395718a2d50b7f600e to your computer and use it in GitHub Desktop.
This file contains 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
public void LoadIniterstialelAd() | |
{ | |
#if __ANDROID__ | |
if (mInterstitialAd.IsLoaded==false) | |
{ | |
var adRequest = new AdRequest.Builder() | |
#if DEBUG | |
.AddTestDevice("DEADBEEF9A2078B6AC72133BB7E6E177") // Prevents generating real impressions while testing | |
#endif | |
.Build(); | |
mInterstitialAd.LoadAd(adRequest); | |
} | |
#elif __IOS__ | |
Request request = Request.GetDefaultRequest(); | |
#if DEBUG | |
request.TestDevices = new[] { "GAD_SIMULATOR_ID", "kGADSimulatorID" }; | |
#endif | |
if (AdViewInterstitial == null || AdViewInterstitial.HasBeenUsed == true) | |
{ | |
Console.WriteLine("Creating AdViewInterstitial"); | |
AdViewInterstitial = new Interstitial(this.AdUnitID); | |
AdViewInterstitial.AdReceived += (object sender, EventArgs e) => | |
{ | |
Console.WriteLine("Add Recived"); | |
}; | |
AdViewInterstitial.ScreenDismissed += delegate | |
{ | |
Console.WriteLine("Dissmised"); | |
Engine.Pause = false; | |
}; | |
AdViewInterstitial.ReceiveAdFailed += (object sender, InterstitialDidFailToReceiveAdWithErrorEventArgs e) => | |
{ | |
Console.WriteLine(e.Error.DebugDescription); | |
}; | |
AdViewInterstitial.LoadRequest(request); | |
} | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment