public AdLoaderClient(AdLoader unityAdLoader) { IntPtr adLoaderClientPtr = (IntPtr)GCHandle.Alloc(this); this.customNativeTemplateCallbacks = unityAdLoader.CustomNativeTemplateClickHandlers; string[] templateIdsArray = new string[unityAdLoader.TemplateIds.Count]; unityAdLoader.TemplateIds.CopyTo(templateIdsArray); NativeAdTypes adTypes = new NativeAdTypes(); if (unityAdLoader.AdTypes.Contains(NativeAdType.CustomTemplate)) { adTypes.CustomTemplateAd = true; } this.AdLoaderPtr = Externs.GADUCreateAdLoader( adLoaderClientPtr, unityAdLoader.AdUnitId, templateIdsArray, templateIdsArray.Length, ref adTypes); Externs.GADUSetAdLoaderCallbacks( this.AdLoaderPtr, AdLoaderDidReceiveNativeCustomTemplateAdCallback, AdLoaderDidFailToReceiveAdWithErrorCallback); }
internal static IAdLoaderClient BuildAdLoaderClient(AdLoader adLoader) { #if UNITY_EDITOR // Testing UNITY_EDITOR first because the editor also responds to the currently // selected platform. return new GoogleMobileAds.Common.DummyClient(); #elif UNITY_ANDROID return new GoogleMobileAds.Android.AdLoaderClient(adLoader); #elif (UNITY_5 && UNITY_IOS) || UNITY_IPHONE return new GoogleMobileAds.iOS.AdLoaderClient(adLoader); #else return new GoogleMobileAds.Common.DummyClient(); #endif }
public AdLoaderClient(AdLoader unityAdLoader) : base(Utils.UnityCustomNativeAdListener) { AndroidJavaClass playerClass = new AndroidJavaClass(Utils.UnityActivityClassName); AndroidJavaObject activity = playerClass.GetStatic<AndroidJavaObject>("currentActivity"); adLoader = new AndroidJavaObject(Utils.NativeAdLoaderClassName, activity, unityAdLoader.AdUnitId, this); this.CustomNativeTemplateCallbacks = unityAdLoader.CustomNativeTemplateClickHandlers; if (unityAdLoader.AdTypes.Contains(NativeAdType.CustomTemplate)) { foreach (string templateId in unityAdLoader.TemplateIds) { adLoader.Call("configureCustomNativeTemplateAd", templateId, this.CustomNativeTemplateCallbacks.ContainsKey(templateId)); } } adLoader.Call("create"); }
public void CreateAdLoader(AdLoader.Builder builder) { Debug.Log("Dummy " + MethodBase.GetCurrentMethod().Name); }