public static AdView InitAdView(Activity activity, LinearLayout adContainer) { try { if (AppSettings.ShowFbBannerAds) { InitializeFacebook.Initialize(activity); AdView adView = new AdView(activity, AppSettings.AdsFbBannerKey, AdSize.BannerHeight50); // Add the ad view to your activity layout adContainer.AddView(adView); #pragma warning disable 618 adView.SetAdListener(new BannerAdListener()); #pragma warning restore 618 // Request an ad adView.LoadAd(); return(adView); } return(null !); } catch (Exception e) { Methods.DisplayReportResultTrack(e); return(null !); } }
public static AdView InitAdView(Activity activity, LinearLayout adContainer) { try { var isPro = ListUtils.MyUserInfoList.FirstOrDefault()?.IsPro ?? 0; if (isPro == 0 && AppSettings.ShowFbBannerAds) { InitializeFacebook.Initialize(activity); AdView adView = new AdView(activity, AppSettings.AdsFbBannerKey, AdSize.BannerHeight50); // Add the ad view to your activity layout adContainer.AddView(adView); adView.SetAdListener(new BannerAdListener()); // Request an ad adView.LoadAd(); return(adView); } return(null); } catch (Exception e) { Console.WriteLine(e); return(null); } }
public static AdView InitAdView(Activity activity, LinearLayout adContainer, RecyclerView mRecycler) { try { if (AppSettings.ShowFbBannerAds) { InitializeFacebook.Initialize(activity); AdView adView = new AdView(activity, AppSettings.AdsFbBannerKey, AdSize.BannerHeight50); // Add the ad view to your activity layout adContainer.AddView(adView); adView.SetAdListener(new BannerAdListener(adContainer, mRecycler)); // Request an ad adView.LoadAd(); return(adView); } else { adContainer.Visibility = ViewStates.Gone; } return(null); } catch (Exception e) { Console.WriteLine(e); return(null); } }