In this Section we will explain how to make an implementation of JAAK KYC for Android.
Before you start you have to have consulted the Section JAAK KYC and that a ShortKey.
Requirements
To start with development with Android using JAAK KYC SDK, follow these steps to set up your environment correctly:
Fitted with SDK 30 to 35
| Level of API | AGP | Kotlin | Core KTX | KSP | KAPT (Mast to KSP) | Hilt | Coroutines Core | Coroutines Android | Coroutines Play Services | Lifecycle Runtime KTX | OkHttp | Retrofit | AppCompat | Material Components | ConstraintLayout | Activities KTX | Core SplashScreen | ML Kit Face Detection | CameraX | Play Services Location | Light Compressor |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 30 | 7.1.3 | 1.7.20 | 1.8.0 | 1.7.20-1.0.29 | N / A | 2.39 | 1.6.2 | 1.6.2 | 1.6.2 | 2.5.0 | 4.9.3 | 2.9.0 | 1.5.1 | 1.6.1 | 2.1.1 | 1.5.1 | 1.0.0 | 16.6.0 | 1.2.1 | 19.3.0 | 0.9.2 |
| 31 | 7.2.0 | 1.8.0 | 1.11.0 | 1.8.0-1.0.29 | N / A | 2.40 | 1.6.4 | 1.6.4 | 1.6.4 | 2.5.1 | 4.9.3 | 2.9.0 | 1.5.2 | 1.6.2 | 2.1.2 | 1.5.2 | 1.0.0 | 16.7.0 | 1.2.1 | 19.4.0 | 0.9.3 |
| 32 | 7.2.2 | 1.8.0 | 1.12.0 | 1.8.0-1.0.29 | N / A | 2.36 | 1.6.4 | 1.6.4 | 1.6.4 | 2.5.0 | 4.9.3 | 2.9.0 | 1.5.0 | 1.7.0 | 2.1.2 | 1.5.0 | 1.0.0 | 16.4.0 | 1.3.0 | 20.2.0 | 0.9.0 |
| 33 | 8.0.2 | 1.9.0 | 1.13.0 | 1.9.0-1.0.30 | N / A | 2.40 | 1.7.0 | 1.7.0 | 1.7.0 | 2.6.0 | 5.0.0 | 2.9.0 | 1.6.0 | 1.9.0 | 2.2.0 | 1.6.0 | 1.0.0 | 17.0.0 | 1.3.0 | 20.3.0 | 1.0.0 |
| 34 | 8.5.0 | 2.0.0 | 1.14.0 | 2.0.0-1.0.31 | N / A | 2.50 | 1.7.5 | 1.7.5 | 1.7.5 | 2.7.0 | 5.0.0 | 2.9.0 | 1.6.1 | 1.10.0 | 2.2.1 | 1.7.0 | 1.0.0 | 17.0.1 | 1.4.0 | 21.0.0 | 1.1.0 |
| 35 | 8.7.3 | 2.1.10 | 1.15.0 | 2.1.10-1.0.31 | N / A | 2.51.1 | 1.8.0 | 1.8.0 | 1.8.0 | 2.8.7 | 5.0.0 | 2.9.0 | 1.7.0 | 1.12.0 | 2.2.1 | 1.10.1 | 1.0.1 | 17.1.0 | 1.4.2 | 21.3.0 | 1.2.0e |
Previous requirements
- Android Studio: Using Meerkat's recommended version.
- Compilation of SDK: To set SDK compilation at 35.
- Source and Target compatibility: Use Java 11.
- minSdkVersion: Configure at 24.
- targetSdkVersion: Configure at 35.
Creation of Android Project with kotlin configuration (default)
-
Open Android Studio.
-
Select New Project and select an appropriate template (e.g., Epty Activity).
-
Configure the name of the application and make sure that the language is Kotlin.
-
Configure compilation values in Gradle Scripts:
The versions that were explained at the start of the document are integrated into libs.versions.toml.
[versions]
agp = "8.7.3"
kotlin = "2.1.10"
coreKtx = "1.15.0"
kspVersion = "2.1.10-1.0.31"
hiltVersion = "2.51.1"
kotlinxCoroutinesAndroid = "1.8.0"
kotlinxCoroutinesAndroidVersion = "1.8.0"
kotlinxCoroutinesCore = "1.6.0"
kotlinxCoroutinesPlayServices = "1.8.0"
lifecycleRuntimeKtx = "2.8.7"
lifecycleRuntimeKtxVersion = "2.8.7"
okhttp = "5.0.0-alpha.2"
retrofit = "2.9.0"
appcompat = "1.7.0"
material = "1.12.0"
constraintLayout = "2.2.1"
activityKtx = "1.10.1"
coreSplashscreen = "1.0.1"
jaakDocumentDetector = "2.0.5"
jaakFaceDetector = "2.0.5"
mlkitFaceDetection = "17.1.0"
cameraX = "1.4.2"
playServicesLocation = "21.3.0"
lightCompressor = "1.2.0"
[libraries]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
androidx-lifecycle-runtime-ktx-v241 = { module = "androidx.lifecycle:lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtxVersion" }
androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycleRuntimeKtx" }
androidx-lifecycle-runtime-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycleRuntimeKtx" }
kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroid" }
kotlinx-coroutines-android-v160 = {module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinxCoroutinesAndroidVersion" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinxCoroutinesCore" }
kotlinx-coroutines-play-services = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "kotlinxCoroutinesPlayServices" }
hilt-android = { group = "com.google.dagger", name = "hilt-android" , version.ref = "hiltVersion"}
hilt-compiler = { group = "com.google.dagger", name = "hilt-compiler" , version.ref = "hiltVersion"}
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" }
google-material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintLayout" }
androidx-activity-ktx = { group = "androidx.activity", name = "activity-ktx", version.ref = "activityKtx" }
androidx-core-splashscreen = { module = "androidx.core:core-splashscreen", version.ref = "coreSplashscreen" }
jaak-document-detector = { module = "com.jaak.documentdetectorsdk:jaakdocumentdetector-sdk", version.ref = "jaakDocumentDetector" }
jaak-face-detector = { module = "com.jaak.facedetectorsdk:jaakfacedetector-sdk", version.ref = "jaakFaceDetector" }
google-mlkit-face-detection = { module = "com.google.android.gms:play-services-mlkit-face-detection", version.ref = "mlkitFaceDetection" }
androidx-camera-camera2 = { module = "androidx.camera:camera-camera2", version.ref = "cameraX" }
androidx-camera-lifecycle = { module = "androidx.camera:camera-lifecycle", version.ref = "cameraX" }
androidx-camera-core = { module = "androidx.camera:camera-core", version.ref = "cameraX" }
androidx-camera-view = { module = "androidx.camera:camera-view", version.ref = "cameraX" }
androidx-camera-video = { module = "androidx.camera:camera-video", version.ref = "cameraX" }
google-play-services-location = { module = "com.google.android.gms:play-services-location", version.ref = "playServicesLocation" }
light-compressor = { module = "com.github.AbedElazizShe:LightCompressor", version.ref = "lightCompressor" }
retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" }
retrofit-converter-gson = { group = "com.squareup.retrofit2", name = "converter-gson", version.ref = "retrofit" }
okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" }
logging-interceptor = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" }
[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlinAndroidKsp = { id = "com.google.devtools.ksp", version.ref ="kspVersion" }
hiltAndroid = { id = "com.google.dagger.hilt.android", version.ref ="hiltVersion" }
At build.gradle (Project), we make reference to android plugin, kotlin, hiltAndroid and kotlinAndroidKSP:
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.hiltAndroid) apply false
alias(libs.plugins.kotlinAndroidKsp) apply false
}
Settings.gradle adds missing maven url at dependent cyResolutionManagement:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven {
url 'https://us-maven.pkg.dev/jaak-platform/jaak-android'
}
maven { url 'https://jitpack.io' }
maven { url 'https://maven.microblink.com' }
}
}
Finally in build.gradle (Module: app), configure the SDK and compatibility and libraries:
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlinAndroidKsp)
alias(libs.plugins.hiltAndroid)
}
android {
compileSdk 35
defaultConfig {
minSdk 24
targetSdk 35
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
}
buildFeatures{
viewBinding = true
}
}
dependencies {
// Core Android dependencies
implementation libs.androidx.core.ktx
implementation libs.androidx.lifecycle.runtime.ktx
// Coroutine Lifecycle Scopes
implementation libs.androidx.lifecycle.viewmodel.ktx
implementation libs.androidx.lifecycle.runtime.ktx.v241
// Coroutines
implementation libs.kotlinx.coroutines.core
implementation libs.kotlinx.coroutines.android
implementation libs.kotlinx.coroutines.core
implementation libs.kotlinx.coroutines.android.v160
implementation libs.kotlinx.coroutines.play.services
implementation(libs.hilt.android)
ksp(libs.hilt.compiler)
implementation libs.androidx.appcompat
implementation libs.google.material
implementation libs.androidx.constraintlayout
implementation libs.androidx.activity.ktx
implementation libs.androidx.lifecycle.viewmodel.ktx
implementation libs.androidx.core.splashscreen
implementation(libs.jaak.document.detector)
implementation(libs.jaak.face.detector)
implementation(libs.google.mlkit.face.detection)
implementation(libs.androidx.camera.camera2)
implementation(libs.androidx.camera.lifecycle)
implementation(libs.androidx.camera.core)
implementation(libs.androidx.camera.view)
implementation(libs.androidx.camera.video)
implementation(libs.google.play.services.location)
implementation(libs.light.compressor)
// Retrofit
implementation(libs.retrofit)
implementation(libs.retrofit.converter.gson)
// OkHttp
implementation(libs.okhttp)
implementation(libs.logging.interceptor)
}
- Click Sync Now to apply changes.
Creation of Android Project with Groovy DSL configuration
-
Open Android Studio.
-
Select New Project and select an appropriate template (e.g., Epty Activity).
-
Configure the name of the application and make sure that the language is Kotlin.
-
Configure compilation values in Gradle Scripts:
To build (Project), configure the Gradle and Plugin version:
dependencies { classpath 'com.android.tools.build:gradle:8.3.2' }In build.gradle (Module: app), configure the SDK and compatibility:
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zipIn build.gradle (Module: app), configure the SDK and compatibility:
android { compileSdk 33 defaultConfig { minSdk 24 targetSdk 33 } compileOptions { sourceCompatibility JavaVersion.VERSION_18 targetCompatibility JavaVersion.VERSION_18 } } -
Click Sync Now to apply changes.
Retrofit Integration for Service Call
All phone calls API That we will conduct next will be through architecture REST (represented State Transfer) with the web standard HTTP (HyperText Transfer Protocol) and signing communication with format JSON (JavaScript Object Note). We recommend that we have at least a basic knowledge of these 3 concepts so that we can continue with this guide.
Now we will use Retrofit, a popular library for consumption of APIs on Android.
-
Add Dependencies:
-
Open the build.gradle file (Module: app).
-
Add the necessary dependencies for Retrofit and Gson:
- Kotlin DSL configuration
[versions] okhttp = "5.0.0-alpha.2" retrofit = "2.9.0" [libraries] retrofit = { group = "com.squareup.retrofit2", name = "retrofit", version.ref = "retrofit" } retrofit-converter-gson = { group = "com.squareup.retrofit2", name = "converter-gson", version.ref = "retrofit" } okhttp = { group = "com.squareup.okhttp3", name = "okhttp", version.ref = "okhttp" } logging-interceptor = { group = "com.squareup.okhttp3", name = "logging-interceptor", version.ref = "okhttp" }// Retrofit implementation(libs.retrofit) implementation(libs.retrofit.converter.gson) // OkHttp implementation(libs.okhttp) implementation(libs.logging.interceptor)- Groovy DSL configuration
dependencies { implementation 'com.squareup.retrofit2:retrofit:2.9.0' implementation 'com.squareup.retrofit2:converter-gson:2.9.0' implementation 'com.squareup.okhttp3:logging-interceptor:4.9.3' } -
-
Configure HTTP Customer:
- To create an interface with demand definitions.
- Implement an instance of Retrofit with OkHttpClient.
-
Use of API:
- To create an instance of service and demand a coroutine or CallAdapter.