Esempio n. 1
0
            public void ShowAd(Activity context, TemplateView template = null)
            {
                try
                {
                    Context = context;

                    Template            = template ?? Context.FindViewById <TemplateView>(Resource.Id.my_template);
                    Template.Visibility = ViewStates.Gone;

                    if (AppSettings.ShowAdMobNative)
                    {
                        AdLoader.Builder builder = new AdLoader.Builder(Context, AppSettings.AdAdMobNativeKey);
                        builder.ForUnifiedNativeAd(this);
                        VideoOptions videoOptions = new VideoOptions.Builder()
                                                    .SetStartMuted(true)
                                                    .Build();
                        NativeAdOptions adOptions = new NativeAdOptions.Builder()
                                                    .SetVideoOptions(videoOptions)
                                                    .Build();

                        builder.WithNativeAdOptions(adOptions);

                        AdLoader adLoader = builder.WithAdListener(new AdListener()).Build();
                        adLoader.LoadAd(new AdRequest.Builder().Build());
                    }
                    else
                    {
                        Template.Visibility = ViewStates.Gone;
                    }
                }
                catch (Exception e)
                {
                    Methods.DisplayReportResultTrack(e);
                }
            }
Esempio n. 2
0
 public static void Ad_AdMobNative(Activity context, TemplateView template = null)
 {
     try
     {
         if (AppSettings.ShowAdMobNative)
         {
             AdMobNative ads = new AdMobNative();
             ads.ShowAd(context, template);
         }
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
     }
 }
Esempio n. 3
0
 public static void Ad_AdMobNative(Activity context, TemplateView template = null)
 {
     try
     {
         if (AppSettings.ShowAdMobNative)
         {
             AdMobNative ads = new AdMobNative();
             ads.ShowAd(context, template);
         }
     }
     catch (Exception exception)
     {
         Console.WriteLine(exception);
     }
 }