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:
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
...
build.gradle
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)
pluginManagement {
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)
repositories {
google()
mavenCentral()
}
}
app/build.gradle
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'
}
The SDK provides some built in Activities example activity to eKYC journey.
Configurations
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:
config | type | required | description |
---|---|---|---|
token | String | yes | Used to identify user to the eKYC platform. Follow this guide to get your token |
enableSound | Bool | no | Enable/disable SDK sound. Default: false |
language | String | no | Platform language, currently support Vietnamese vi or English en . Default: vi |
cardTypes | List<TVCardType > | no | Allowed card types for SDK capture. This is configurable from settings. Supported cards can be found here. Default: allow all card types |
flowId | String | no | The specific eKYC flow you want to execute |
singleStep | String | no | Optional Single Step mode |
You can configure SDK to run a specific step directly by setting singleStep
.
Supported values for singleStep
:
Value | Description |
---|---|
"ekyc.id_card" | Only ID Card capture |
"ekyc.selfie" | Only Selfie capture |
If
singleStep
is not used, SDK defaults to full eKYC flow based onflowId
.
Available flowId
values:
flowId | description |
---|---|
id_selfie | ID → Selfie |
selfie_id | Selfie → ID |
id_nfc_selfie | ID → NFC → Selfie |
qr_nfc_selfie | QR → NFC → Selfie |
Callbacks: The SDK provides 3 callbacks to handle the result of the eKYC journey
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
bool
. SDK internal flag for fully completed stateval 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:
param | type | required | description |
---|---|---|---|
activity | Activity | yes | The current activity |
platformConfigs | nativeConfigs | yes | The configurations for the eKYC platform journey |
baseUrl | String | yes | The base URL of the eKYC platform |
capturingCallback | PlatformCallbacks | yes | The callback to handle the result of the eKYC journey |
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
param | type | required | description |
---|---|---|---|
activity | Activity | yes | The current activity |
configs | webConfigs | yes | The configurations for the eKYC platform webview journey |
capturingCallback | PlatformCallbacks | yes | The callback to handle the result of the eKYC journey |