// Creates a NativeExpressAd with a custom position. public NativeExpressAdView(string adUnitId, AdSize adSize, int x, int y) { this.client = GoogleMobileAdsClientFactory.BuildNativeExpressAdClient(); this.client.CreateNativeExpressAdView(adUnitId, adSize, x, y); configureNativeExpressAdEvents(); }
public NativeExpressAdView(string adUnitId, AdSize adSize, int x, int y) { MethodInfo method = Type.GetType("GoogleMobileAds.GoogleMobileAdsClientFactory,Assembly-CSharp").GetMethod("BuildNativeExpressAdClient", BindingFlags.Public | BindingFlags.Static); this.client = (INativeExpressAdClient)method.Invoke(null, null); this.client.CreateNativeExpressAdView(adUnitId, adSize, x, y); this.ConfigureNativeExpressAdEvents(); }
// Creates a NativeExpressAd and adds it to the view hierarchy. public NativeExpressAdView(string adUnitId, AdSize adSize, AdPosition position) { Type googleMobileAdsClientFactory = Type.GetType( "GoogleMobileAds.GoogleMobileAdsClientFactory,Assembly-CSharp"); MethodInfo method = googleMobileAdsClientFactory.GetMethod( "BuildNativeExpressAdClient", BindingFlags.Static | BindingFlags.Public); this.client = (INativeExpressAdClient)method.Invoke(null, null); this.client.CreateNativeExpressAdView(adUnitId, adSize, position); configureNativeExpressAdEvents(); }
// Creates a NativeExpressAd and adds it to the view hierarchy. public NativeExpressAdView(string adUnitId, AdSize adSize, AdPosition position) { this.client = GoogleMobileAdsClientFactory.BuildNativeExpressAdClient(); this.client.CreateNativeExpressAdView(adUnitId, adSize, position); this.client.OnAdLoaded += (sender, args) => this.OnAdLoaded(this, args); this.client.OnAdFailedToLoad += (sender, args) => this.OnAdFailedToLoad(this, args); this.client.OnAdOpening += (sender, args) => this.OnAdOpening(this, args); this.client.OnAdClosed += (sender, args) => this.OnAdClosed(this, args); this.client.OnAdLeavingApplication += (sender, args) => this.OnAdLeavingApplication(this, args); }