檢視 Android Getting Started SDK8 的原始碼
←
Android Getting Started SDK8
跳至導覽
跳至搜尋
由於下列原因,您沒有權限進行編輯此頁面的動作:
您請求的操作只有這個群組的使用者能使用:
使用者
您可以檢視並複製此頁面的原始碼。
== <b>簡介</b> == :TAMedia SDK提供Android Mobile App開發者簡易迅速的方式整合行動App廣告, 廣告的種類包含<br> :<ul><li>Banner</li></ul> :<ul><li>Interstitial</li></ul> :<ul><li>InRead Anchor</li></ul> :<ul><li>Native</li></ul> <br> == <b>系統需求</b> == :Android 5.0以上 (API Level 21+) <br> == <b>Android Studio專案整合SDK</b> == 請按照下列方式設置專案<br><br> <big><u>Step 1: 將SDK放入app專案的<b>libs</b>資料夾</u></big><br><br> :請至[[Download MADP Android SDK|下載 Download SDK]]下載SDK,並將壓縮檔內的AAR檔 (adpmobile-lib-r8.0.0.aar) 放至專案的libs資料夾, 若無libs資料夾請自行建立<br> [[檔案:AS SDK8 aar.png | 300px]] <br> <big><u>Step 2-1: 編輯app專案中<b>build.gradle</b></u></big><br> [[檔案:AS SDK8 gradle.png | 300px]] <br> :請加入TAMedia SDK aar與下列相依性函式庫 :<ul><li>LocalBroadcastManager</li></ul> :<ul><li>kotlin</li></ul> :<ul><li>kotlin-coroutines</li></ul> :<ul><li>retrofit</li></ul> :<ul><li>google play service identifier</li></ul> :<ul><li>gson</li></ul> :<ul><li>lifecycle</li></ul> <source> dependencies { // =======================================================================// // MADP library // =======================================================================// implementation files('libs/adpmobile-lib-r8.0.0.aar') // =======================================================================// // MADP library dependencies // =======================================================================// // LocalBroadcastManager implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0' // kotlin implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.10' // kotlin-coroutines implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.0" // retrofit implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0' implementation 'com.squareup.retrofit2:converter-scalars:2.9.0' // google play service identifier implementation 'com.google.android.gms:play-services-ads-identifier:17.0.1' // gson implementation 'com.google.code.gson:gson:2.8.6' // lifecycle def lifecycle_version = "2.4.0-alpha03" def arch_version = "2.1.0" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel-savedstate:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-common-java8:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-process:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-reactivestreams-ktx:$lifecycle_version" testImplementation "androidx.arch.core:core-testing:$arch_version" } </source> :compileOptions請加入JAVA 8 <source> android { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } </source> <br> <big><u>Step 2-2: 在Project的<b>build.gradle</b>的repositories內加入google()</u></big><br> [[檔案:Import SDK7 Step2-2.PNG]] :Google Play Service版本若為11.2+, 必須在repositories新增<b>google()</b>, 這是因為Google Play Service自11.2版本後, 改透過maven.google.com取得<br>SDK8 使用 kotlin 語言,需下載 kotlin 函式庫 buildscript { <b>ext.kotlin_version = "1.5.10"</b> repositories { <b>google()</b> jcenter() } dependencies { classpath 'com.android.tools.build:gradle:4.0.1' //SDK8 Kotlin <b>classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"</b> // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { <b>google()</b> jcenter() } } <br><br> <big><u>Step 3: 在<b>AndroidManifest.xml</b>的manifest tag宣告權限</u></big><br> [[檔案:Import SDK7 Step3-1.PNG]] :<ul><li>Required Permission</li></ul> <!-- TAMedia Required Permission --> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> :<ul><li>Optional Permission</li></ul> <!-- TAMedia Optional Permission --> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <br><br> <big><u>Step 4: 在<b>AndroidManifest.xml</b>的manifest tag宣告Activity</u></big><br> <!-- TAMedia Activity --> <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> <br> [[Android SDK Developer Guide 2 | 回首頁]]
返回到「
Android Getting Started SDK8
」。
導覽選單
個人工具
登入
命名空間
頁面
討論
變體
已展開
已摺疊
視圖
閱讀
檢視原始碼
檢視歷史
更多
已展開
已摺疊
搜尋
導覽
首頁
近期變更
隨機頁面
有關 MediaWiki 的說明
工具
連結至此的頁面
相關變更
特殊頁面
頁面資訊