예제 #1
0
 protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
 {
     try
     {
         int count = 1;
         IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
         if (!settings.Contains("radioBackCount"))
         {
             settings.Add("radioBackCount", 1);
         }
         else
         {
             count = (int)IsolatedStorageSettings.ApplicationSettings["radioBackCount"];
             settings["radioBackCount"] = count + 1;
         }
         settings.Save();
         if (count % 3 == 0)
         {
             interstitialAd.ShowAd();
         }
     }
     catch (Exception ex)
     {
         NavigationService.GoBack();
     }
 }
        public void InterstitialAdDidLoad(InterstitialAd interstitialAd)
        {
            Console.WriteLine($"{nameof (InterstitialAdDidLoad)} - Ad is loaded and ready to be displayed");

            // You can now display the full screen ad using this code:
            interstitialAd.ShowAd(this);
        }
 private void OnAdReceived(object sender, AdEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("Ad received successfully");
     interstitialAd.ShowAd();   
 
    
 
 }
예제 #4
0
 private void interstitialAd_ReceivedAd(object sender, AdEventArgs e)
 {
     if (!App.ViewModel.Settings.IsTrial)
     {
         return;
     }
     interstitialAd.ShowAd();
     App.ViewModel.ShowInterstitialAd = false;
 }
예제 #5
0
 private void OnAdReceived(object sender, AdEventArgs e)
 {
     try
     {
         interstitialAd.ShowAd();
     }
     catch (Exception ex)
     {
     }
 }
예제 #6
0
 /// <summary>
 /// Shows an interstitial as long as one is loaded
 /// </summary>
 public static void ShowInterstitial()
 {
     EtceteraWindows.RunOnUIThread(() =>
     {
         if (interstitialAd != null)
         {
             interstitialAd.ShowAd();
         }
     });
 }
예제 #7
0
 public static void ShowVideo()
 {
     EtceteraWindows.RunOnUIThread(() =>
     {
         if (videoAd != null)
         {
             videoAd.ShowAd();
         }
     });
 }
예제 #8
0
        private void OnAdReceived(object sender, AdEventArgs e)
        {
            Random P = new Random();
            int    I = P.Next(1, 10);

            if (I > 5)
            {
                interstitialAd.ShowAd();
            }
        }
예제 #9
0
        private void OnAdReceived(object sender, AdEventArgs e)
        {
            Random p = new Random();
            int    j = p.Next(1, 100);

            if (j >= 88)
            {
                interstitialAd.ShowAd();
            }
        }
예제 #10
0
        private void _showFullScreenAd()
        {
            if (fullScreenAdPreload)
            {
                //An exception of type 'System.NullReferenceException' occurred in GoogleAds.DLL and wasn't handled before a managed/native boundary
                try
                {
                    interstitialView.ShowAd();
                }
                catch (Exception ex)
                {
                }

                fullScreenAdPreload = false;
            }
            else
            {
                _preloadFullScreenAd();
            }
        }
예제 #11
0
        public void _showInterstitialAd()
        {
            if (fullScreenAdPreload)
            {
                fullScreenAdPreload = false;

                //An exception of type 'System.NullReferenceException' occurred in GoogleAds.DLL and wasn't handled before a managed/native boundary
                try
                {
                    interstitialView.ShowAd();
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }
            }
            else
            {
                loadinterstitialAd();
            }
        }
예제 #12
0
    void Start()
    {
        AdSdk.Instance.DisableReturnAds();
        AdSdk.Instance.SetTestAdsEnabled(true);
        var config = new SplashConfig {
            TemplateTheme = SplashConfig.Theme.Blaze
        };

        AdSdk.Instance.ShowSplash(config);
        AdSdk.Instance.SetUserConsent(
            "pas",
            true,
            (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalMilliseconds);

        // AdSdk.Instance.ShowDefaultAd();

        ad = AdSdk.Instance.CreateInterstitial("myTagForFullscreen");
        ad.RaiseAdLoaded += (sender, e) => {
            Debug.Log("Unity::RaiseAdLoaded");
            if (ad.IsReady())
            {
                ad.ShowAd();
            }
        };

        ad.RaiseAdShown          += (sender, e) => Debug.Log("Unity::RaiseAdShown");
        ad.RaiseAdImpressionSent += (sender, e) => Debug.Log("Unity::RaiseAdImpressionSent");
        ad.RaiseAdLoadingFailed  += (sender, e) => Debug.Log(string.Format("Unity::RaiseAdLoadingFailed {0}", e.Message));
        ad.RaiseAdClosed         += (sender, e) => Debug.Log("Unity::RaiseAdClosed");
        ad.RaiseAdClicked        += (sender, e) => Debug.Log("Unity::RaiseAdClicked");
        ad.RaiseAdVideoCompleted += (sender, e) => Debug.Log("Unity::RaiseAdVideoCompleted");
        InvokeRepeating("LoadInterstitial", 10.0f, 0.0f);

        var banner = AdSdk.Instance.CreateBanner("myTagForBanner");

        banner.ShowInPosition(BannerAd.BannerPosition.Top, BannerAd.BannerType.Mrec);

        banner.RaiseBannerShown          += (sender, e) => Debug.Log("Unity::RaiseBannerShown");
        banner.RaiseBannerImpressionSent += (sende, e) => Debug.Log("Unity::RaiseBannerImpressionSent");
        banner.RaiseBannerLoadingFailed  += (sender, e) => Debug.Log(string.Format("Unity::RaiseBannerLoadingFailed {0}", e.Message));
        banner.RaiseBannerClicked        += (sender, e) => Debug.Log("Unity::RaiseBannerClicked");
        banner.Hide();

        if (!banner.IsShownInPosition(BannerAd.BannerPosition.Top))
        {
            // AdSdk.Instance.ShowDefaultBanner(BannerAd.BannerPosition.Bottom, "myBottomBanner");
            AdSdk.Instance.ShowDefaultBanner();
            banner.ShowInPosition(BannerAd.BannerPosition.Top);
        }
    }
예제 #13
0
        protected void __showInterstitial()
        {
            if (interstitialAd == null)
            {
                if (logVerbose)
                {
                    Debug.WriteLine("interstitial is null, call prepareInterstitial() first.");
                }
                return;
            }

            Deployment.Current.Dispatcher.BeginInvoke(() => {
                interstitialAd.ShowAd();
            });
        }
예제 #14
0
        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
        {
            //Do your work here
            try
            {
                interstitialAd.ShowAd();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
                var result = MessageBox.Show("Come back soon!", "Are you sure?", MessageBoxButton.OKCancel);
                e.Cancel = result != MessageBoxResult.OK;
            }

            base.OnBackKeyPress(e);
        }
예제 #15
0
 private void OnShowInterstitialClick(object sender, EventArgs e)
 {
     // Show Interstitial can only be clicked after an interstitial is received.
     interstitialAd.ShowAd();
 }
예제 #16
0
        // Interstitial events
        private void onRecievedInterstitialAd(object sender, AdEventArgs args)
        {
            interstitialAd.ShowAd();

            eventCallback("cordova.fireDocumentEvent('onReceiveInterstitialAd');");
        }
예제 #17
0
 private void OnAdReceivedFull(object sender, AdEventArgs e)
 {
     interstitialAd.ShowAd();
 }