「Android Integeration with New AdMob Mediation 2.0」修訂間的差異
跳至導覽
跳至搜尋
imported>Wikiuser |
imported>Wikiuser |
||
行 1: | 行 1: | ||
Mopub網站: https://app.mopub.com, 登入可對後台進行設定。<br> | |||
註: 請將擋廣告的插件關閉(如Adblock),否則後台瀏覽、設定會有問題<br><br> | |||
== Mopub後台設定 == | |||
: | <big><u>Step 1: 新增APP與版位,取得Mopub版位ID</u></big><br> | ||
進入Apps分頁後,點擊Add a New App<br> | |||
[[image:Mopub_Step1-1.png | 700px]]<br><br> | |||
輸入APP資訊,如APP Name、Package Name…等<br> | |||
[[image:Mopub_Step1-2.png | 700px]]<br><br> | |||
新增版位並進行設定<br> | |||
:a. Format為橫幅廣告Banner (320x50):<br> | |||
[[image:Mopub_Step1-3.png | 700px]]<br><br> | |||
:b. Format為插頁式廣告Fullscreen (320x480):<br> | |||
[[image:Mopub_Step1-4.png | 700px]]<br><br> | |||
:c. Format為原生廣告Native (Custom Layout):<br> | |||
[[image:Mopub_Step1-5.png | 700px]]<br><br> | |||
完成設定後,點選Save and View Code Integration,並記下Mopub的版位ID<br> | |||
[[image:Mopub_Step1-6.png | 700px]]<br><br> | |||
[[image:Mopub_Step1-7.png | 700px]]<br><br> | |||
若欲新增其他版位,請點選剛剛新增的APP並點選Add an Ad Unit<br> | |||
[[image:Mopub_Step1-8.png | 700px]]<br><br> | |||
[[image:Mopub_Step1-9.png | 700px]]<br><br> | |||
<br> | |||
<br> | |||
<big><u>Step 2: 新增廣告聯播網</u></big><br> | |||
進入Network分頁,並點選Add a Network<br> | |||
[[image:Mopub_Step2-1.png | 700px]]<br><br> | |||
點選Custom Native Network<br> | |||
[[image:Mopub_Step2-2.png | 700px]]<br><br> | |||
設定Network Title(名字可任意取),並設定實作的類別名稱與參數,以下以Banner作為範例:<br> | |||
[[image:Mopub_Step2-3.png | 700px]]<br><br> | |||
依欄位填入<br> | |||
<ol> | |||
<li>Custom Event Class: 用於實作com.mopub.mobileads.CustomEventBanner的類別名稱,必須輸入完整的package name,如com.taiwanmobile.pt.adp.mediation.TAMediaMopubBanner</li> | |||
<li>Custom Event Class Data: 請依指定格式輸入您的版位ID (可向您的TAMedia窗口詢問),格式為 {"adUnitId":"<版位ID>"}</li> | |||
</ol> | |||
輸入完畢後,後台會自動儲存<br> | |||
[[image:Mopub_Step2-4.png | 700px]]<br><br> | |||
最後進入Segment分頁,啟用方才設定的聯播網<br> | |||
[[image:Mopub_Step2-5.png | 700px]]<br><br> | |||
若有多個聯播網,可透過eCPM調整不同聯播網的優先權<br> | |||
[[image:Mopub_Step2-6.png | 700px]]<br><br> | |||
<br> | |||
<br> | |||
== Mopub程式整合 == | |||
<big><u>Step 1: Download TAMedia & Mopub SDK</u></big><br> | |||
:a. 請參照 [https://github.com/mopub/mopub-android-sdk/wiki/Getting-Started#requirements-and-dependencies Mopub Github] 所提供的方式,將Mopub SDK加到您的專案中。<br> | |||
:b. [[Download Android SDK 2 | Download TAMedia SDK]]<br><br> | |||
<big><u>Step 2: 在AndroidManifest.xml加入所需的權限與Activity</u></big><br> | |||
<!-- Mopub & TAMedia Permission --> | |||
<uses-permission android:name="android.permission.INTERNET" /> | |||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> | |||
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- optional --> | |||
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- optional --><br> | |||
<!-- TAMedia Permission --> | |||
<uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- SDK4.0以上版本請移除 --> | |||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> | |||
<uses-permission android:name="android.permission.VIBRATE" /> <!-- optional --> | |||
<uses-permission android:name="android.permission.CAMERA"/> <!-- optional, SDK4.0上請加入, 以獲得更豐富的廣告內容 --> | |||
<uses-permission android:name="android.permission.RECORD_AUDIO"/> <!-- optional, SDK4.0上請加入, 以獲得更豐富的廣告內容 --><br> | |||
<!-- Mopub Permission --> | |||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |||
<!-- TAMedia Activities --> | |||
<activity | |||
android:name="com.taiwanmobile.pt.adp.view.TWMAdActivity" | |||
android:configChanges="orientation|keyboardHidden|navigation|keyboard|screenLayout|uiMode|screenSize|smallestScreenSize" | |||
android:hardwareAccelerated="true" | |||
android:theme="@android:style/Theme.Translucent" > | |||
</activity> | |||
: | |||
<!-- Mopub activity --> | |||
<activity android:name="com.mopub.mobileads.MoPubActivity" android:configChanges="keyboardHidden|orientation|screenSize"/> | |||
<activity android:name="com.mopub.mobileads.MraidActivity" android:configChanges="keyboardHidden|orientation|screenSize"/> | |||
<activity android:name="com.mopub.common.MoPubBrowser" android:configChanges="keyboardHidden|orientation|screenSize"/> | |||
<activity android:name="com.mopub.mobileads.RewardedMraidActivity" android:configChanges="keyboardHidden|orientation|screenSize" /> | |||
<activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity" android:configChanges="keyboardHidden|orientation|screenSize"/> | |||
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" /> | |||
<!-- Mopub meta-data --> | |||
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/> | |||
於 2017年5月17日 (三) 09:11 的修訂
Mopub網站: https://app.mopub.com, 登入可對後台進行設定。
註: 請將擋廣告的插件關閉(如Adblock),否則後台瀏覽、設定會有問題
Mopub後台設定
Step 1: 新增APP與版位,取得Mopub版位ID
進入Apps分頁後,點擊Add a New App
輸入APP資訊,如APP Name、Package Name…等
新增版位並進行設定
- a. Format為橫幅廣告Banner (320x50):
- b. Format為插頁式廣告Fullscreen (320x480):
- c. Format為原生廣告Native (Custom Layout):
完成設定後,點選Save and View Code Integration,並記下Mopub的版位ID
若欲新增其他版位,請點選剛剛新增的APP並點選Add an Ad Unit
Step 2: 新增廣告聯播網
進入Network分頁,並點選Add a Network
設定Network Title(名字可任意取),並設定實作的類別名稱與參數,以下以Banner作為範例:
依欄位填入
- Custom Event Class: 用於實作com.mopub.mobileads.CustomEventBanner的類別名稱,必須輸入完整的package name,如com.taiwanmobile.pt.adp.mediation.TAMediaMopubBanner
- Custom Event Class Data: 請依指定格式輸入您的版位ID (可向您的TAMedia窗口詢問),格式為 {"adUnitId":"<版位ID>"}
Mopub程式整合
Step 1: Download TAMedia & Mopub SDK
- a. 請參照 Mopub Github 所提供的方式,將Mopub SDK加到您的專案中。
- b. Download TAMedia SDK
Step 2: 在AndroidManifest.xml加入所需的權限與Activity
<!-- Mopub & TAMedia Permission --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <!-- optional --> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <!-- optional -->
<!-- TAMedia Permission --> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <!-- SDK4.0以上版本請移除 --> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.VIBRATE" /> <!-- optional --> <uses-permission android:name="android.permission.CAMERA"/> <!-- optional, SDK4.0上請加入, 以獲得更豐富的廣告內容 --> <uses-permission android:name="android.permission.RECORD_AUDIO"/> <!-- optional, SDK4.0上請加入, 以獲得更豐富的廣告內容 -->
<!-- Mopub Permission --> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!-- TAMedia Activities --> <activity android:name="com.taiwanmobile.pt.adp.view.TWMAdActivity" android:configChanges="orientation|keyboardHidden|navigation|keyboard|screenLayout|uiMode|screenSize|smallestScreenSize" android:hardwareAccelerated="true" android:theme="@android:style/Theme.Translucent" > </activity> <!-- Mopub activity --> <activity android:name="com.mopub.mobileads.MoPubActivity" android:configChanges="keyboardHidden|orientation|screenSize"/> <activity android:name="com.mopub.mobileads.MraidActivity" android:configChanges="keyboardHidden|orientation|screenSize"/> <activity android:name="com.mopub.common.MoPubBrowser" android:configChanges="keyboardHidden|orientation|screenSize"/> <activity android:name="com.mopub.mobileads.RewardedMraidActivity" android:configChanges="keyboardHidden|orientation|screenSize" /> <activity android:name="com.mopub.mobileads.MraidVideoPlayerActivity" android:configChanges="keyboardHidden|orientation|screenSize"/> <activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<!-- Mopub meta-data --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>