IDGraph Android Getting Started (New)
於 2024年10月22日 (二) 08:43 由 BrandonTeng(留言 | 貢獻) 所做的修訂 (建立內容為「== 系統需求 == :Android SDK Version: 21+ <br> == SDK整合 == *<big>以 Android Studio 進行整合</big> :將SDK AAR檔放到APP專案的libs資料夾中<br> :檔案:IDGraph-Andorid-img01_new.png<br> <br> :在 build.gradle 的dependencies內宣告對aar檔的使用,程式碼如下: <source lang="groovy"> implementation fileTree(dir: 'libs', include: ['*.aar']) </source> <br> :在 build.gradle 的dependencies內增加IDGraph SDK相依性套件…」的新頁面)
系統需求
- Android SDK Version: 21+
SDK整合
- 以 Android Studio 進行整合
- 在 build.gradle 的dependencies內宣告對aar檔的使用,程式碼如下:
implementation fileTree(dir: 'libs', include: ['*.aar'])
- 在 build.gradle 的dependencies內增加IDGraph SDK相依性套件:
dependencies {
// IDGraph dependencies --------------------------------
// retrofit
implementation libs.retrofit
implementation libs.retrofit.gson
implementation libs.retrofit.scalars
implementation libs.okhttp
// coroutines
implementation libs.coroutines.core
implementation libs.coroutines.android
// ads-identifier
implementation libs.gms.ads.identifier
// IDGraph dependencies --------------------------------
}
- 上述函式庫版本資訊 (/gradle/libs.versions.toml)
[versions]
playServicesBasement = "18.4.0"
retrofit = "2.9.0"
okhttp = "4.11.0"
coroutines = "1.7.3"
adsIdentifier = "18.1.0"
[libraries]
# IDGraph Dependencies
play-services-basement = { module = "com.google.android.gms:play-services-basement", version.ref = "playServicesBasement" }
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
retrofit-gson = { group = "com.squareup.retrofit2", name = "converter-gson", version.ref = "retrofit" }
retrofit-scalars = { group = "com.squareup.retrofit2", name = "converter-scalars", version.ref = "retrofit" }
okhttp = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" }
coroutines-core = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version.ref = "coroutines" }
coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "coroutines" }
gms-ads-identifier = { group = "com.google.android.gms", name = "play-services-ads-identifier", version.ref = "adsIdentifier" }
# IDGraph Dependencies
- 加入必要權限
- 在 AndroidManifest.xml 內加入下列Permission:
<uses-permission android:name="android.permission.INTERNET"/>