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 APIAGPKotlinCore KTXKSPKAPT (Mast to KSP)HiltCoroutines CoreCoroutines AndroidCoroutines Play ServicesLifecycle Runtime KTXOkHttpRetrofitAppCompatMaterial ComponentsConstraintLayoutActivities KTXCore SplashScreenML Kit Face DetectionCameraXPlay Services LocationLight Compressor
307.1.31.7.201.8.01.7.20-1.0.29N / A2.391.6.21.6.21.6.22.5.04.9.32.9.01.5.11.6.12.1.11.5.11.0.016.6.01.2.119.3.00.9.2
317.2.01.8.01.11.01.8.0-1.0.29N / A2.401.6.41.6.41.6.42.5.14.9.32.9.01.5.21.6.22.1.21.5.21.0.016.7.01.2.119.4.00.9.3
327.2.21.8.01.12.01.8.0-1.0.29N / A2.361.6.41.6.41.6.42.5.04.9.32.9.01.5.01.7.02.1.21.5.01.0.016.4.01.3.020.2.00.9.0
338.0.21.9.01.13.01.9.0-1.0.30N / A2.401.7.01.7.01.7.02.6.05.0.02.9.01.6.01.9.02.2.01.6.01.0.017.0.01.3.020.3.01.0.0
348.5.02.0.01.14.02.0.0-1.0.31N / A2.501.7.51.7.51.7.52.7.05.0.02.9.01.6.11.10.02.2.11.7.01.0.017.0.11.4.021.0.01.1.0
358.7.32.1.101.15.02.1.10-1.0.31N / A2.51.11.8.01.8.01.8.02.8.75.0.02.9.01.7.01.12.02.2.11.10.11.0.117.1.01.4.221.3.01.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)

  1. Open Android Studio.

  2. Select New Project and select an appropriate template (e.g., Epty Activity).

  3. Configure the name of the application and make sure that the language is Kotlin.

  4. 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)
}
  1. Click Sync Now to apply changes.

Creation of Android Project with Groovy DSL configuration

  1. Open Android Studio.

  2. Select New Project and select an appropriate template (e.g., Epty Activity).

  3. Configure the name of the application and make sure that the language is Kotlin.

  4. 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.zip
    

    In 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
        }
    }
    
  5. 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.

  1. 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'
    }
    
  2. Configure HTTP Customer:

    • To create an interface with demand definitions.
    • Implement an instance of Retrofit with OkHttpClient.
  3. Use of API:

    • To create an instance of service and demand a coroutine or CallAdapter.