public void onCustomClick(AndroidJavaObject ad, string assetName) { if (this.OnCustomNativeTemplateAdClicked != null) { CustomNativeClientEventArgs args = new CustomNativeClientEventArgs() { nativeAdClient = new CustomNativeTemplateClient(ad), assetName = assetName }; this.OnCustomNativeTemplateAdClicked(this, args); } }
public void onCustomTemplateAdLoaded(AndroidJavaObject ad) { if (this.OnCustomNativeTemplateAdLoaded != null) { CustomNativeClientEventArgs args = new CustomNativeClientEventArgs() { nativeAdClient = new CustomNativeTemplateClient(ad), assetName = null }; this.OnCustomNativeTemplateAdLoaded(this, args); } }
private static void AdLoaderDidReceiveNativeCustomTemplateAdCallback( IntPtr adLoader, IntPtr nativeCustomTemplateAd, string templateID) { AdLoaderClient client = IntPtrToAdLoaderClient(adLoader); CustomNativeTemplateClient adClient = new CustomNativeTemplateClient( nativeCustomTemplateAd); if (client.OnCustomNativeTemplateAdClicked != null && client.TemplateIds[templateID] == true) { WeakReference weakClient = new WeakReference(adClient); adClient.clickHandler = delegate(string assetName) { if (weakClient.IsAlive) { CustomNativeTemplateClient strongClient = weakClient.Target as CustomNativeTemplateClient; CustomNativeClientEventArgs args = new CustomNativeClientEventArgs() { nativeAdClient = strongClient, assetName = assetName }; client.OnCustomNativeTemplateAdClicked(client, args); } }; } if (client.OnCustomNativeTemplateAdLoaded != null) { CustomNativeClientEventArgs args = new CustomNativeClientEventArgs() { nativeAdClient = adClient, assetName = null }; client.OnCustomNativeTemplateAdLoaded(client, args); } }