「IDGraph Android Getting Started (New)」修訂間的差異
跳至導覽
跳至搜尋
BrandonTeng(留言 | 貢獻) (→SDK整合) |
BrandonTeng(留言 | 貢獻) (→SDK整合) |
||
行 4: | 行 4: | ||
== SDK整合 == | == SDK整合 == | ||
:將SDK AAR檔放到APP專案的libs資料夾中<br> | :將SDK AAR檔放到APP專案的libs資料夾中 | ||
<br> | |||
:[[檔案:IDGraph-Andorid-img01_new.png|500px|aar file in libs folder|]]<br> | :[[檔案:IDGraph-Andorid-img01_new.png|500px|aar file in libs folder|]]<br> | ||
<br> | <br> |
於 2024年10月23日 (三) 01:49 的修訂
系統需求
- Android SDK Version: 21+
SDK整合
- 將SDK AAR檔放到APP專案的libs資料夾中
- 在 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"/>