「IDGraph Android Getting Started (New)」修訂間的差異

出自TAMedia
跳至導覽 跳至搜尋
 
(未顯示同一使用者於中間所作的 6 次修訂)
行 4: 行 4:


== SDK整合 ==
== SDK整合 ==
*<big>以 Android Studio 進行整合</big>
<br>
:將SDK AAR檔放到APP專案的libs資料夾中<br>
:將SDK AAR檔放到APP專案的libs資料夾中
:[[檔案: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>
行 56: 行 56:


<br>
<br>
*<big>加入必要權限</big>
 
== 權限設定 ==
:在 <b>AndroidManifest.xml</b> 內加入下列Permission:
:在 <b>AndroidManifest.xml</b> 內加入下列Permission:
   <uses-permission android:name="android.permission.INTERNET"/>
   <uses-permission android:name="android.permission.INTERNET"/>

於 2024年10月23日 (三) 01:58 的最新修訂

系統需求

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首頁