void AddToView() { if (interstitialRequested) { return; } if (adInterstitial == null) { InterstitialAd.Load(intersitialId, Request.GetDefaultRequest(), (ad, err) => { if (ad != null) { adInterstitial = ad; adInterstitial.DismissedContent += (sender, e) => { interstitialRequested = false; // You need to explicitly Dispose Interstitial when you dont need it anymore // to avoid crashes if pending request are in progress adInterstitial.Dispose(); adInterstitial = null; }; adInterstitial.Present(navController); } else { interstitialRequested = false; } }); } }
void DrawInterstitialAdvs() { m_rect.x += m_rect.width + 30.0f; m_rect.y = 40; m_rect.width = Screen.width * 0.25f; m_rect.height = Screen.height * 0.15f; if (GUI.Button(m_rect, "Create Interstitial Ad")) { InterstitialAd l_interAd = AdmobManager.PrepareInterstitialAd("Interstitial_1"); //OR //InterstitialAd l_interAd = AdmobManager.Prepare<InterstitialAd>("Interstitial_1"); l_interAd.AdUnitId = "ca-app-pub-4192487455949741/8306159319"; l_interAd.Create(); } m_rect.y = m_rect.y + m_rect.height; if (GUI.Button(m_rect, "Load Interstitial Ad")) { InterstitialAd l_interAd = AdmobManager.Get <InterstitialAd>("Interstitial_1"); l_interAd.Load(); } m_rect.y = m_rect.y + m_rect.height; if (GUI.Button(m_rect, "Show Interstitial Ad")) { InterstitialAd l_interAd = AdmobManager.Get <InterstitialAd>("Interstitial_1"); l_interAd.Show(); } }
void CreateAndRequestInterstitial() { if (adInterstitial == null) { InterstitialAd.Load(AdMobConstants.IntersitialId, GetRequest(), (ad, err) => { if (ad != null) { adInterstitial = ad; } }); } }
void LoadInterstitial() { #if UNITY_ANDROID string slotId = "57342e3d7174ea39844cac14"; #elif UNITY_IOS || UNITY_IPHONE string slotId = "573430057174ea39844cac16"; #else return; #endif if (interstitialAd != null) { interstitialAd.Destroy(); interstitialAd = null; } interstitialAd = new InterstitialAd(slotId); interstitialAd.OnAdLoaded += InterstitialAd_OnAdLoaded; interstitialAd.OnAdFailedToLoad += InterstitialAd_OnAdFailedToLoad; interstitialAd.OnAdClicked += InterstitialAd_OnAdClicked; interstitialAd.OnAdShown += InterstitialAd_OnAdShown; interstitialAd.OnAdDismissed += InterstitialAd_OnAdDismissed; interstitialAd.Load(); }
public void Intestinal_Ad_Load() { InterstitialAd l_interAd = AdmobManager.Get <InterstitialAd>("Interstitial_1"); l_interAd.Load(); }