Getting Started
Prerequisite to integrate with the Android SDK
Requirements
- Android version 21 (Lollipop) and above
Installation
AAR
1. Add .aar & .pom files
- Create a libs folder within your module if it does not exist.
- Paste the given .aar file in the libs folder.
- Add the following in module’s build.gradle file, replace <filename> with the .aar file name
dependencies {
//other dependencies
implementation(files("libs/<filename>.aar"))
}- Implement the dependencies from the .pom file as well, whichever does not already exist in the
module’s dependencies. A helper tool to convert the .pom dependencies to gradle/kotlin dsl is to use
maven2gradle or maven-to-gradle-kotlin-dsl respectively. It might look something like this:
implementation("androidx.databinding:viewbinding:7.3.1")
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("androidx.core:core-ktx:1.10.1")
implementation("androidx.constraintlayout:constraintlayout:2.0.1")
implementation("androidx.work:work-runtime-ktx:2.8.1")
implementation("androidx.work:work-testing:2.8.1")
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.6.2")
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2")
implementation("androidx.exifinterface:exifinterface:1.3.7")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.10")
implementation("org.jetbrains.kotlin:kotlin-parcelize-runtime:1.8.10")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3")
implementation("com.squareup.okhttp3:okhttp:4.11.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.11.0")
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
implementation("com.google.code.gson:gson:2.10.1")
implementation("com.google.android.material:material:1.4.0")
implementation("com.google.dagger:dagger-android-support:2.43.2")
implementation("com.google.protobuf:protobuf-javalite:3.11.0")- Note that the using versions lower than this might cause build issues.
- Once the implementations are finalised, do sync project with gradle files.
Dependencies
| Name | Dependency | Version |
|---|---|---|
| Appcompat | androidx.appcompat:appcompat | 1.6.1 |
| Constraint Layout | androidx.constraintlayout:constraintlayout | 2.0.1 |
| Core | androidx.core:core-ktx | 1.10.1 |
| View Binding | androidx.databinding:viewbinding | 7.3.1 |
| Dagger | com.google.dagger:dagger-android-support | 2.43.0 |
| Material | com.google.android.material:material | 1.4.0 |
| EXIF Interface | androidx.exifinterface:exifinterface | 1.3.7 |
| OkHttp | com.squareup.okhttp3:okhttp | 4.11.0 |
| com.squareup.okhttp3:logging-interceptor | ||
| WorkManager | androidx.work:work-runtime-ktx | 2.8.1 |
| androidx.work:work-testing | ||
| Lifecycle | androidx.lifecycle:lifecycle-livedata-ktx | 2.6.2 |
| androidx.lifecycle:lifecycle-viewmodel-ktx | ||
| Coroutines | org.jetbrains.kotlinx:kotlinx-coroutines-android | 1.7.3 |
| org.jetbrains.kotlinx:kotlinx-coroutines-core | ||
| Kotlin | org.jetbrains.kotlin:kotlin-parcelize-runtime | 1.8.10 |
| org.jetbrains.kotlin:kotlin-stdlib-jdk8 |
Permissions
| Name | Description |
|---|---|
| CAMERA | Required to capture KTP and Selfie images. |
| INTERNET | Required to connect to backend services and upload documents |
| ACCESS_WIFI_STATE | Allows the application to check the state of Wi-Fi connectivity, ensuring smooth operation in network-dependent tasks. |
| ACCESS_NETWORK_STATE | Enables the application to monitor the device's overall network connectivity, allowing fallback mechanisms if the network state changes. |
Initialise SDK Instance
Usage
private val myClientConfig: DigitalIdentityClientConfig
private val myEventTracker: IDigitalIdentityEventTracker
private val myHttpClient: OkHttpClient
val instance: DigitalIdentitySdk = DigitalIdentityProvider.getInstance(
appContext = applicationContext,
clientConfig = myClientConfig,
eventTracker = myEventTracker,
httpClient = myHttpClient
)Properties
-
appContext: Application context.
-
clientConfig: Instance of DigitalIdentityClientConfig for user configuration. It contains the following properties:
data class DigitalIdentityClientConfig( val userId: Int, val userName: String = "", val environment: ClientEnvironment = ClientEnvironment.PRODUCTION )-
userId: The unique identifier for the user.
-
userName: [Optional] [Default: empty] The username associated with the user.
-
environment: [Optional] [Default: ClientEnvironment.PRODUCTION] The environment to use for the SDK, e.g., PRODUCTION, STAGING, etc.
enum class ClientEnvironment { STAGING, PRODUCTION }
-
-
eventTracker: Implementation of IDigitalidentityEventTracker for tracking events.
class MyEventTracker : IDigitalIdentityEventTracker { override fun track( eventName: String, eventProperties: Map<String, Any?>, productName: String? ) { // Callback is triggered by SDK with event and data to be tracked if required } } -
httpClient: [Optional] parameter to provide custom OkHttpClient implementation.
Returns
DigitalIdentitySdk instance. Use the returned DigitalIdentitySdk instance to initiate SDK flows.
Clear SDK Instance
Usage
DigitalIdentityProvider.dispose()Call this method to release the SDK instance and free up resources, allowing it to re-initialize later if needed. Please note that if any instance of DigitalIdentitySdk is invoked post calling this method, it will cause a crash.
Clear SDK Cache Data
Usage
// Let instance be an instance of DigitalIdentitySdk
instance.clearCache()Call this method to clear the cache of the SDK. It is possible to call this method after dispose.
Updated about 1 month ago