檢視 Android Mopub Interstitial 的原始碼
←
Android Mopub Interstitial
跳至導覽
跳至搜尋
由於下列原因,您沒有權限進行編輯此頁面的動作:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
請建立一個Class並繼承Mopub所提供的CustomEventInterstitial<br><br> Class實作內容如下:<br> package com.taiwanmobile.pt.adp.mediation; import android.app.Activity; import android.content.Context; import android.util.Log; import com.mopub.mobileads.CustomEventInterstitial; import com.mopub.mobileads.MoPubErrorCode; import com.taiwanmobile.pt.adp.view.TWMAd; import com.taiwanmobile.pt.adp.view.TWMAdRequest; import com.taiwanmobile.pt.adp.view.TWMAdViewListener; import com.taiwanmobile.pt.adp.view.TWMInterstitialAd; import java.util.Map; // 需將本class的完整類別名稱 com.taiwanmobile.pt.adp.mediation.TAMediaMopubInterstitial 填入後台的Custom Event Class欄位 public class TAMediaMopubInterstitial extends CustomEventInterstitial { private static final String TAG = "TAMediaInterstitial"; private TWMInterstitialAd interstitialAd = null; private CustomEventInterstitialListener mInterstitialListener; @Override protected void loadInterstitial(final Context context, final CustomEventInterstitialListener customEventInterstitialListener, final Map<String, Object> localExtras, final Map<String, String> serverExtras) { Log.d(TAG, "loadInterstitial(" + serverExtras.get("adUnitId") + ") invoked!!"); mInterstitialListener = customEventInterstitialListener; String adUnitId = serverExtras.get("adUnitId"); '''//後台設定的adUnitId會透過此Key值取得''' interstitialAd = new TWMInterstitialAd( (Activity)context, adUnitId ); interstitialAd.setAdListener(new TWMAdViewListener(){ @Override public void onReceiveAd(TWMAd ad) { mInterstitialListener.onInterstitialLoaded(); } @Override public void onFailedToReceiveAd(TWMAd ad, TWMAdRequest.ErrorCode errorCode) { mInterstitialListener.onInterstitialFailed(MoPubErrorCode.NETWORK_NO_FILL); } @Override public void onPresentScreen(TWMAd ad) { mInterstitialListener.onInterstitialClicked(); } @Override public void onDismissScreen(TWMAd ad) { mInterstitialListener.onInterstitialDismissed(); } @Override public void onLeaveApplication(TWMAd ad) { mInterstitialListener.onLeaveApplication(); } }); interstitialAd.loadAd(new TWMAdRequest()); } @Override protected void showInterstitial() { // Called when MoPubInterstitial Object called show() if (interstitialAd != null) { interstitialAd.show(); mInterstitialListener.onInterstitialShown(); } } @Override protected void onInvalidate() { // Called when MoPubInterstitial is being invalidated or destroyed. } } <br><br> [[Android Integeration with Mopub Mediation|回MoPub教學]]<br>
返回到「
Android Mopub Interstitial
」。
導覽選單
個人工具
登入
命名空間
頁面
討論
變體
已展開
已摺疊
視圖
閱讀
檢視原始碼
檢視歷史
更多
已展開
已摺疊
搜尋
導覽
首頁
近期變更
隨機頁面
有關 MediaWiki 的說明
工具
連結至此的頁面
相關變更
特殊頁面
頁面資訊