IDGraph Android Getting Started (New)

出自TAMedia
跳至導覽 跳至搜尋

系統需求

Android SDK Version: 21+


SDK整合


將SDK AAR檔放到APP專案的libs資料夾中
IDGraph-Andorid-img01 new.png


在 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"/>


回IDGraph Android SDK首頁