Help Center/Details/

Banner

iOS:

You can configure basic information of customized express banner ads by using BUNativeExpressBannerView. For example, when configuring the desired size, in order to avoid deformation of the ad view during the rendering process, you must use the same size configurations as the media platform. By setting BUNativeExpressBannerViewDelegate, you can get callbacks for ads, impressions, clicks, and closes. Please note that the rootViewController must be set as this is the viewController required for jumping to the landing page.

Android:

You can configure the desired size of customized express banner ads by using SetExpressViewAcceptedSize of the AdSlot.Invoke LoadExpressBannerAd(AdSlot adSlot, IExpressAdListener listener) of the AdNative to load the ad object ExpressAd.Invoke the NativeAdManager.Instance().ShowExpressBannerAd method to display ads. Refer to the demo for a detailed example.Note that after using the ad object, you need to invoke NativeAdManager.Instance().DestoryExpressAd to release resources and reduce memory usage.

Load Express Banner Ad

public void LoadExpressBannerAd()
    {
        var adSlot = new AdSlot.Builder()
#if UNITY_IOS
           .SetCodeId("your ios placement id")
#else
           .SetCodeId("your android placement id")
                              
#endif                                         

.SetExpressViewAcceptedSize(UnityEngine.Screen.width,float.Parse(UnityEngine.Screen.width.ToString()) / 600 * 90)                                       .SetImageAcceptedSize(1080, 1920)
    .Build();

    this.AdNative.LoadExpressBannerAd(adSlot, new ExpressAdListener(this, 1));
    }

Display Express Banner Ad

/// <summary>
    /// Show the reward Ad.
    /// </summary>
    public void ShowExpressBannerAd()
    {
#if UNITY_IOS
        if (this.iExpressBannerAd == null)
        {
            Debug.LogError("no ad to show");
            this.information.text = "no ad to show";
            return;
        }

        this.inputX = GameObject.Find("Canvas/InputFieldX").GetComponent<InputField>();
        this.inputY = GameObject.Find("Canvas/InputFieldY").GetComponent<InputField>();

        int x;
        int y;
        int.TryParse(this.inputX.text, out x);
        int.TryParse(this.inputY.text, out y);
        Debug.Log("Show x axis ---" + x);
        Debug.Log("Show y axis ---" + y);

        if (y == 0)
        {
            y = 100;
        }

        this.iExpressBannerAd.ShowExpressAd(x, y);
#else
        if (this.mExpressBannerAd == null)
        {
            Debug.LogError("no ad to show");
            this.information.text = "no ad to show";
            return;
        }        
//automate display  this.mExpressBannerAd.SetSlideIntervalTime(30*1000);
        ExpressAdInteractionListener expressAdInteractionListener = new ExpressAdInteractionListener(this, 1);
        ExpressAdDislikeCallback dislikeCallback = new ExpressAdDislikeCallback(this,1);
        this.mExpressBannerAd.SetDownloadListener(new AppDownloadListener(this));
        NativeAdManager.Instance().ShowExpressBannerAd(GetActivity(), mExpressBannerAd.handle, expressAdInteractionListener, dislikeCallback);
#endif
    }

AdListener

private sealed class ExpressAdInteractionListener : IExpressAdInteractionListener
    {
        private Example example;
        int type;//0:feed   1:banner  2:interstitial

        public ExpressAdInteractionListener(Example example, int type)
        {
            this.example = example;
            this.type = type;
        }
        public void OnAdClicked(ExpressAd ad)
        {
            Debug.LogError("express OnAdClicked,type:" + type);
            this.example.information.text = "OnAdClicked:" + type;
        }

        public void OnAdShow(ExpressAd ad)
        {
            Debug.LogError("express OnAdShow,type:" + type);
            this.example.information.text = "OnAdShow:" + type;
        }

        public void OnAdViewRenderError(ExpressAd ad, int code, string message)
        {
            Debug.LogError("express OnAdViewRenderError,type:" + type);
            this.example.information.text = "OnAdViewRenderError:" + message + ":" + type;
        }

        public void OnAdViewRenderSucc(ExpressAd ad, float width, float height)
        {
            Debug.LogError("express OnAdViewRenderSucc,type:"+type);
            this.example.information.text = "OnAdViewRenderSucc:" + type;
        }
        public void OnAdClose(ExpressAd ad)
        {
            Debug.LogError("express OnAdClose,type:" + type);
            this.example.information.text = "OnAdClose:" + type;
        }
        public void onAdRemoved(ExpressAd ad)
        {
            Debug.LogError("express onAdRemoved,type:" + type);
            this.example.information.text = "onAdRemoved:" + type;
        }
    }

Reference

Express Banner Ad Interface

public sealed class ExpressBannerAd {
    
            public int index;
    
            internal ExpressBannerAd(AndroidJavaObject expressAd) { }
            /// <summary>
            /// Gets the interaction type.
            /// </summary>
            public int GetInteractionType () {
                return 0;
            }
            public AndroidJavaObject handle { get { return null; } }
    
            /// <summary>
            /// Sets the interaction listener for this Ad.
            /// </summary>
            public void SetExpressInteractionListener (IExpressAdInteractionListener listener) 
            { 
            }
    
            /// <summary>
            /// Sets the dislike callback.
            /// </summary>
            /// <param name="dislikeCallback">Dislike callback.</param>
            public void SetDislikeCallback(IDislikeInteractionListener dislikeCallback)
            {
    
            }
    
            /// <summary>
            /// Sets the download listener.
            /// </summary>
            public void SetDownloadListener (IAppDownloadListener listener) { }
    
            /// <summary>
            /// Set this Ad not allow sdk count down.
            /// </summary>
            public void SetNotAllowSdkCountdown () { }
    
            /// <summary>
            /// show the  express Ad
            /// <param name="x">the x of th ad</param>
            /// <param name="y">the y of th ad</param>
            /// </summary>
            public void ShowExpressAd (float x, float y) { }
    
            /// <inheritdoc/>
            public void Dispose() { }
    
        }
Did the content solve your problem?