Android Mopub Getting Started
於 2017年9月6日 (三) 04:04 由 imported>Wikiuser 所做的修訂
請依照下列步驟設置專案
Step 1: Download TAMedia & Mopub SDK
- a. 請參照 Mopub Github 所提供的方式,將Mopub SDK加到您的專案中。
- b. Download TAMedia SDK, 強烈建議使用SDK5以利MoPub後台數據追蹤
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" />
<!-- meta-data --> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>