public void OnExpressBannerAdLoad(ExpressBannerAd ad) { Debug.Log("OnExpressBannerAdLoad"); this.example.information.text = "OnExpressBannerAdLoad"; ad.SetExpressInteractionListener( new ExpressAdInteractionListener(this.example,1)); ad.SetDownloadListener( new AppDownloadListener(this.example)); this.example.iExpressBannerAd = ad; }
/// <summary> /// Load Banner Ad. /// </summary> public void LoadBannerAd(int type) { ////remove old banner #if UNITY_IOS if (this.iExpressBannerAd != null) { this.iExpressBannerAd.Dispose(); this.iExpressBannerAd = null; } #else #endif float expressWidth = 320; float expressHeight = 50; #if UNITY_IOS string ritID = "900546833"; if (type == 1) { ritID = "945509778"; expressWidth = 300; expressHeight = 250; } #else string ritID = "945467907"; if (type == 1) { ritID = "945509744"; expressWidth = 300; expressHeight = 250; } #endif var adSlot = new AdSlot.Builder() .SetCodeId(ritID) ////期望模板广告view的size,单位dp,//高度设置为0,则高度会自适应//Only Android ,you must set height for iOS .SetExpressViewAcceptedSize(expressWidth, expressHeight) .SetImageAcceptedSize(1080, 1920) .SetAdCount(1) .SetOrientation(AdOrientation.Horizontal) .Build(); this.AdNative.LoadExpressBannerAd(adSlot, new ExpressAdListener(this, 1)); }
/// <summary> /// Dispose the reward Ad. /// </summary> public void DisposeAds() { #if UNITY_IOS if (this.rewardAd != null) { this.rewardAd.Dispose(); this.rewardAd = null; } if (this.fullScreenVideoAd != null) { this.fullScreenVideoAd.Dispose(); this.fullScreenVideoAd = null; } if (this.nativeFeedAd != null) { this.nativeFeedAd.Dispose(); this.nativeFeedAd = null; } if (this.mExpressFeedad != null) { this.mExpressFeedad.Dispose(); this.mExpressFeedad = null; } //if (this.intersititialAd != null) //{ // this.intersititialAd.Dispose(); // this.intersititialAd = null; //} if (this.expressRewardAd != null) { this.expressRewardAd.Dispose(); this.expressRewardAd = null; } if (this.expressFullScreenVideoAd != null) { this.expressFullScreenVideoAd.Dispose(); this.expressFullScreenVideoAd = null; } if (this.iExpressBannerAd != null) { this.iExpressBannerAd.Dispose(); this.iExpressBannerAd = null; } #else if (this.rewardAd != null) { this.rewardAd = null; } if (this.fullScreenVideoAd != null) { this.fullScreenVideoAd = null; } if (this.mNativeAd != null) { this.mNativeAd = null; } if (this.mExpressFeedad != null) { NativeAdManager.Instance().DestoryExpressAd(mExpressFeedad.handle); mExpressFeedad = null; } if (this.mExpressBannerAd != null) { NativeAdManager.Instance().DestoryExpressAd(mExpressBannerAd.handle); mExpressBannerAd = null; } if (this.mExpressInterstitialAd != null) { NativeAdManager.Instance().DestoryExpressAd(mExpressInterstitialAd.handle); mExpressInterstitialAd = null; } #endif }