Beispiel #1
0
        public virtual int Load(int uniqueId, String bidPayload)
        {
            NativeAdBase nativeAd = nativeAds[uniqueId];

            nativeAd.LoadAdFromData();
            return(uniqueId);
        }
        public virtual int Load(int uniqueId)
        {
            NativeAdBase nativeAd = this.nativeAds [uniqueId];

            nativeAd.loadAdFromData();
            return(uniqueId);
        }
 public void SetAd(NativeAdBase nativeAd)
 {
     text.text                = nativeAd.AdChoicesText;
     linkURL                  = nativeAd.AdChoicesLinkURL;
     imageUrl                 = nativeAd.AdChoicesImageURL;
     canvasGroup.alpha        = 1;
     canvasGroup.interactable = true;
     StartCoroutine(LoadAdChoicesImage());
 }
Beispiel #4
0
        public override int Create(string placementId, NativeAdBase nativeBannerAd)
        {
            int uniqueId = NativeBannerAdBridgeIOS.FBNativeBannerAdBridgeCreate(placementId);

            NativeBannerAdBridgeIOS.nativeBannerAds.Add(uniqueId, new NativeAdContainer(nativeBannerAd));
            NativeBannerAdBridgeIOS.FBNativeBannerAdBridgeOnLoad(uniqueId, nativeBannerAdDidLoadBridgeCallback);
            NativeBannerAdBridgeIOS.FBNativeBannerAdBridgeOnImpression(uniqueId, nativeBannerAdWillLogImpressionmpressionBridgeCallback);
            NativeBannerAdBridgeIOS.FBNativeBannerAdBridgeOnClick(uniqueId, nativeBannerAdDidClickBridgeCallback);
            NativeBannerAdBridgeIOS.FBNativeBannerAdBridgeOnError(uniqueId, nativeBannerAdDidFailWithErrorBridgeCallback);
            NativeBannerAdBridgeIOS.FBNativeBannerAdBridgeOnFinishedClick(uniqueId, nativeBannerAdDidFinishHandlingClickBridgeCallback);
            NativeBannerAdBridgeIOS.FBNativeBannerAdBridgeOnMediaDownloaded(uniqueId, nativeBannerAdDidDownloadMediaBridgeCallback);

            return(uniqueId);
        }
Beispiel #5
0
        override public int Create(string placementId, NativeAdBase nativeAd)
        {
            AdUtility.Prepare();
            AndroidJavaClass  unityPlayer     = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject currentActivity = unityPlayer.GetStatic <AndroidJavaObject>("currentActivity");
            AndroidJavaObject context         = currentActivity.Call <AndroidJavaObject>("getApplicationContext");

            String androidAdClass = "";

            if (nativeAd.nativeAdType == NativeAdType.NativeAd)
            {
                androidAdClass = "com.facebook.ads.NativeAd";
            }
            else if (nativeAd.nativeAdType == NativeAdType.NativeBannerAd)
            {
                androidAdClass = "com.facebook.ads.NativeBannerAd";
            }

            AndroidJavaObject bridgedNativeAd = new AndroidJavaObject(androidAdClass, context, placementId);

            NativeAdBridgeListenerProxy proxy = new NativeAdBridgeListenerProxy(nativeAd, bridgedNativeAd);

            bridgedNativeAd.Call("setAdListener", proxy);

            NativeAdContainer nativeAdContainer = new NativeAdContainer(nativeAd)
            {
                bridgedNativeAd = bridgedNativeAd,
                listenerProxy   = proxy,
                context         = context
            };

            int key = NativeAdBridgeAndroid.lastKey;

            NativeAdBridgeAndroid.nativeAds.Add(key, nativeAdContainer);
            NativeAdBridgeAndroid.lastKey++;
            return(key);
        }
Beispiel #6
0
 public virtual int Create(string placementId, NativeAdBase nativeAd)
 {
     nativeAds.Add(nativeAd);
     return(nativeAds.Count - 1);
 }
Beispiel #7
0
 public NativeAdBridgeListenerProxy(NativeAdBase nativeAd, AndroidJavaObject bridgedNativeAd)
     : base("com.facebook.ads.NativeAdListener")
 {
     this.nativeAd        = nativeAd;
     this.bridgedNativeAd = bridgedNativeAd;
 }
Beispiel #8
0
 internal NativeAdContainer(NativeAdBase nativeAd)
 {
     this.nativeAd = nativeAd;
 }