「Android Getting Started SDK8」修訂間的差異

出自TAMedia
跳至導覽 跳至搜尋
imported>Wikiuser
imported>Wikiuser
行 1: 行 1:
== <b>簡介</b> ==
== <b>簡介</b> ==
:TAMedia SDK提供Android Mobile App開發者簡易迅速的方式整合行動App廣告, 廣告的種類包含橫幅Banner, 全版Interstitial, Rich Media, 原生性廣告以及InRead廣告, 使用上跟Google Mobile Ads (Admob)類似, 能大量節省開發者學習時間
: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>
<br>
== <b>系統需求</b> ==
== <b>系統需求</b> ==
行 8: 行 13:
== <b>Android Studio專案整合SDK</b> ==
== <b>Android Studio專案整合SDK</b> ==
請按照下列方式設置專案<br><br>
請按照下列方式設置專案<br><br>
<big><u>Step 1: 將SDK放入app專案的<b>libs</b>資料夾</u></big><br>
<big><u>Step 1: 將SDK放入app專案的<b>libs</b>資料夾</u></big><br><br>
:請至[[Download MADP Android SDK|下載 Download SDK]]下載SDK,並將壓縮檔內的AAR檔 (adpmobile-lib-rx.x.x.aar) 放至專案的libs資料夾, 若無libs資料夾請自行建立<br>
:請至[[Download MADP Android SDK|下載 Download SDK]]下載SDK,並將壓縮檔內的AAR檔 (adpmobile-lib-r8.0.0.aar) 放至專案的libs資料夾, 若無libs資料夾請自行建立<br>


[[檔案:AS SDK8 aar.png | 300px]]
[[檔案:AS SDK8 aar.png | 300px]]


<big><u>Step 2-1: 在app的<b>build.gradle</b>的dependencies內加入下列程式 (請根據aar檔名字自行調整)</u></big><br>
<br>
<big><u>Step 2-1: 編輯app專案中<b>build.gradle</b></u></big><br>


[[檔案:AS SDK8 gradle.png | 300px]]
[[檔案:AS SDK8 gradle.png | 300px]]


:請加入TAMedia的SDK和下列相依性函式庫
<br>
:請加入TAMedia SDK aar與下列相依性函式庫
:<ul><li>LocalBroadcastManager</li></ul>
:<ul><li>LocalBroadcastManager</li></ul>
:<ul><li>kotlin</li></ul>
:<ul><li>kotlin</li></ul>
行 69: 行 76:


:compileOptions請加入JAVA 8
:compileOptions請加入JAVA 8
<source>
   android {
   android {
     compileOptions {
     compileOptions {
行 75: 行 84:
     }
     }
   }
   }
</source>
<br>
<br>



於 2021年9月7日 (二) 05:44 的修訂

簡介

TAMedia SDK提供Android Mobile App開發者簡易迅速的方式整合行動App廣告, 廣告的種類包含
  • Banner
  • Interstitial
  • InRead Anchor
  • Native


系統需求

Android 5.0以上 (API Level 21+)


Android Studio專案整合SDK

請按照下列方式設置專案

Step 1: 將SDK放入app專案的libs資料夾

請至下載 Download SDK下載SDK,並將壓縮檔內的AAR檔 (adpmobile-lib-r8.0.0.aar) 放至專案的libs資料夾, 若無libs資料夾請自行建立

AS SDK8 aar.png


Step 2-1: 編輯app專案中build.gradle

AS SDK8 gradle.png


請加入TAMedia SDK aar與下列相依性函式庫
  • LocalBroadcastManager
  • kotlin
  • kotlin-coroutines
  • retrofit
  • google play service identifier
  • gson
  • lifecycle
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"
}


compileOptions請加入JAVA 8
  android {
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
  }


Step 2-2: 在Project的build.gradle的repositories內加入google()

Import SDK7 Step2-2.PNG

Google Play Service版本若為11.2+, 必須在repositories新增google(), 這是因為Google Play Service自11.2版本後, 改透過maven.google.com取得
SDK8 使用 kotlin 語言,需下載 kotlin 函式庫
 buildscript {
     ext.kotlin_version = "1.5.10"
     repositories {
         google()
         jcenter()
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:4.0.1'
         //SDK8 Kotlin
         classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"          
         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
     }
 }
 
 allprojects {
     repositories {
         google()
         jcenter()
     }
 }



Step 3: 在AndroidManifest.xml的manifest tag宣告權限

Import SDK7 Step3-1.PNG

  • Required Permission
 <!-- 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" />
  • Optional Permission
 <!-- 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" />



Step 4: 在AndroidManifest.xml的manifest tag宣告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>


回首頁