• About TrustVision
  • Android SDK
  • iOS SDK
  • Flutter SDK
  • React Native SDK
  • Web SDK
  • API Client Libraries
  • Integration Case Studies
  • TS eKYC/FA App
TrustVision API Documentation

Android v4.0.x

OVERVIEW

TrustVision SDK is the android SDK for TrustVision Engine. This document is for Clients who only use the UI of the SDK. It provides these features:

Specifications

  • Gradle Version 7.3.3
  • Tested with Gradle Plugin for Android Studio - version 7.2.2
  • minSdkVersion 21
  • targetSdkVersion 33
  • Support Kotlin version 1.5.0 - 1.8.0

Integration Steps

1. Adding the SDK to your project

  • Get library file tv_sdk_client.zip, extract and put all files into a folder in android project. Example: folder ${project.rootDir}/repo

Note : tv_sdk_client Each client will have a SDK name. That SDK name will contain the name of the client

app
root
repo
    +--com
        +--trustvision
            +--tv_api_sdk
                +--4.0.x
                    +--tv_api_sdk-4.0.x.aar
                    +--tv_api_sdk-4.0.x.pom
                maven-metadata.xml
            +--tv_core_sdk
            +--tv_sdk_client
...
  • Add the following set of lines to the Project (top-level) build.gradle
groovy
buildscript {
    ext.kotlin_version = '1.6.21' // or any version that >= 1.5 and < 1.8

    repositories {
        maven {
            url 'https://maven.google.com'
        }
        mavenCentral()
        google()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        maven { url "https://maven.google.com" }
        maven { url "https://jitpack.io" }
        maven { url "path/to/tvsdk/folder" }  // example : maven { url "${project.rootDir}/repo" }
        ...
    }
}

Note : If your project uses the new way to define repositories (central declaration of repositories), you must change repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) to repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)

groovy
pluginManagement {
    repositories {
        google()
        mavenCentral()
        gradlePluginPortal()
    }
}
dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
    repositories {
        google()
        mavenCentral()
    }
}
  • Add the following set of lines to your app/build.gradle
groovy
android {
    ...
    aaptOptions {
        noCompress "tflite"
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation('com.trustvision:tv_sdk_client:4.x.x@aar') {
        transitive = true
    }
    testImplementation 'junit:junit:4.12'

}

2. Start the SDK

The SDK provides some built in Activities example activity to eKYC journey.

2.1. eKYC Platform

2.1.1. eKYC Configs

Configurations

kotlin
val platformConfigs = TrustVision.configsProvider().nativeConfigs(
  token = YOUR_USER_TOKEN,
  enableSound = true,
  language = 'vi',
  cardTypes = List<TVCardType>,
  flowId = 'your_flow_id',
  singleStep = "your_single_step",
)

Where:

configtyperequireddescription
tokenStringyesUsed to identify user to the eKYC platform. Follow this guide to get your token
enableSoundBoolnoEnable/disable SDK sound. Default: false
languageStringnoPlatform language, currently support Vietnamese vi or English en. Default: vi
cardTypesList<TVCardType>noAllowed card types for SDK capture. This is configurable from settings. Supported cards can be found here. Default: allow all card types
flowIdStringnoThe specific eKYC flow you want to execute
singleStepStringnoOptional Single Step mode

You can configure SDK to run a specific step directly by setting singleStep.

Supported values for singleStep:

ValueDescription
"ekyc.id_card"Only ID Card capture
"ekyc.selfie"Only Selfie capture

If singleStep is not used, SDK defaults to full eKYC flow based on flowId.

Available flowId values:

flowIddescription
id_selfieID → Selfie
selfie_idSelfie → ID
id_nfc_selfieID → NFC → Selfie
qr_nfc_selfieQR → NFC → Selfie

Callbacks: The SDK provides 3 callbacks to handle the result of the eKYC journey

kotlin
val ekycPlatformCallback = object : PlatformCallbacks {
    override fun onDone(result: PlatformCallbackResult) {
      // handle the result
    }
    override fun onError(error: PlatformCallbackResult) {
      // handle the error
    }
    override fun onCanceled(reason: PlatformCallbackResult) {
      // handle the cancel
    }
}

Platform Callback Result: The result of the eKYC journey. Currently return these types of result: FAILED, SUCCEEDED, CLOSE, CAMERA_PERMISSION_DENIED

  • fullyCompleted: bool. SDK internal flag for fully completed state

2.1.2. Start eKYC platform journey

kotlin
val baseUrl = YOUR_BASE_URL
val platformConfigs = TrustVision.configsProvider().nativeConfigs(
  token = YOUR_USER_TOKEN,
  enableSound = true,
  language = 'vi',
  cardTypes = listOf(TVCardType.cccdNew(), TVCardType.tcc()),
  flowId = 'your_flow_id',
  singleStep = "your_single_step",
)
val ekycPlatformCallback = object : PlatformCallbacks {
  override fun onDone(result: PlatformCallbackResult) {
    // handle the result
  }
  override fun onError(error: PlatformCallbackResult) {
    // handle the error
  }
  override fun onCanceled(reason: PlatformCallbackResult) {
    // handle the cancel
  }
}
TrustVision.startEkycPlatform(
    activity,
    platformConfigs,
    baseUrl = baseUrl,
    capturingCallback = ekycPlatformCallback
)

Where:

paramtyperequireddescription
activityActivityyesThe current activity
platformConfigsnativeConfigsyesThe configurations for the eKYC platform journey
baseUrlStringyesThe base URL of the eKYC platform
capturingCallbackPlatformCallbacksyesThe callback to handle the result of the eKYC journey

2.2. eKYC Platform webview

2.2.1. Start eKYC platform webview journey

kotlin
val url = YOUR_URL
val configs = TrustVision.configsProvider().webConfigs(url)
val ekycPlatformCallback = object : PlatformCallbacks {
  override fun onDone(result: PlatformCallbackResult) {
    // handle the result
  }
  override fun onError(error: PlatformCallbackResult) {
    // handle the error
  }
  override fun onCanceled(reason: PlatformCallbackResult) {
    // handle the cancel
  }
}
TrustVision.startEkycPlatform(activity, configs, ekycPlatformCallback)

where

paramtyperequireddescription
activityActivityyesThe current activity
configswebConfigsyesThe configurations for the eKYC platform webview journey
capturingCallbackPlatformCallbacksyesThe callback to handle the result of the eKYC journey