Ejemplo n.º 1
0
        public static InterstitialAd InitInterstitial(Activity activity)
        {
            try
            {
                var isPro = ListUtils.MyUserInfoList.FirstOrDefault()?.IsPro ?? 0;
                if (isPro == 0 && AppSettings.ShowFbInterstitialAds)
                {
                    if (CountInterstitial == AppSettings.ShowAdMobInterstitialCount)
                    {
                        InitializeFacebook.Initialize(activity);

                        CountInterstitial = 0;
                        var interstitialAd = new InterstitialAd(activity, AppSettings.AdsFbInterstitialKey);

                        interstitialAd.SetAdListener(new MyInterstitialAdListener(activity, interstitialAd));
                        // Request an ad
                        interstitialAd.LoadAd();

                        return(interstitialAd);
                    }

                    CountInterstitial++;
                }
                return(null);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
Ejemplo n.º 2
0
        public static InterstitialAd InitInterstitial(Activity activity)
        {
            try
            {
                if (AppSettings.ShowFbInterstitialAds)
                {
                    if (CountInterstitial == AppSettings.ShowAdMobInterstitialCount)
                    {
                        InitializeFacebook.Initialize(activity);

                        CountInterstitial = 0;
                        var interstitialAd = new InterstitialAd(activity, AppSettings.AdsFbInterstitialKey);

                        #pragma warning disable 618
                        interstitialAd.SetAdListener(new MyInterstitialAdListener(activity, interstitialAd));
                        #pragma warning restore 618
                        // Request an ad
                        interstitialAd.LoadAd();

                        return(interstitialAd);
                    }

                    CountInterstitial++;
                }
                return(null !);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
                return(null !);
            }
        }
Ejemplo n.º 3
0
        public static InterstitialAd InitInterstitial(Activity activity)
        {
            try
            {
                if (AppSettings.ShowFbInterstitialAds)
                {
                    if (CountInterstitial == AppSettings.ShowAdMobInterstitialCount)
                    {
                        InitializeFacebook.Initialize(activity);

                        CountInterstitial = 0;
                        var interstitialAd = new InterstitialAd(activity, AppSettings.AdsFbInterstitialKey);

                        interstitialAd.SetAdListener(new MyInterstitialAdListener(activity, interstitialAd));
                        // Request an ad
                        interstitialAd.LoadAd();

                        return(interstitialAd);
                    }

                    CountInterstitial++;
                }
                return(null);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(null);
            }
        }
Ejemplo n.º 4
0
        void loadInterstitialAd()
        {
            var placementId = Resources.GetString(Resource.String.fb_placement_id);

            interstitialAd = new InterstitialAd(this, placementId);
            interstitialAd.SetAdListener(this);
            interstitialAd.LoadAd();
        }
 public void ShowAds()
 {
     interstitialAd = new InterstitialAd(Android.App.Application.Context, "YOUR_ADS_UNIT_DS"); //Ads Unit ID
     interstitialAd.LoadAd();
     interstitialAd.SetAdListener(new InterstitialAdListener(interstitialAd));
 }