This guide provides step-by-step instructions on integrating the IDV SDK into an Android application. It covers initialization, API configuration, workflow setup, and starting the ID verification process.
Before integrating the SDK, ensure the following:
- Android Target SDK 36 recommended
- Camera permission enabled
- NFC permission enabled
- Internet permission enabled
- Regula IDV SDK dependency added to
build.gradle.kts
-
Add url to Regula's maven repository in you
build.gradle.ktsfile maven { url = uri("https://maven.regulaforensics.com/RegulaDocumentReader") }// only for Beta versions maven { url = uri("https://maven.regulaforensics.com/RegulaDocumentReader/Beta") }
-
Copy regula.license and db.dat files to
app/src/main/assets/Regulafolder. -
Enable view and data bingings features in your app-level
build.gradle.ktsby adding toandroidsection:
buildFeatures {
viewBinding=true
dataBinding=true
}and add kotlin-kapt plugin:
plugins {
id("kotlin-kapt")
}- In your app-level
build.gradle.kts, add the following dependency:
// Required only if you're going to use DocReader SDK in your workflows
implementation("com.regula.documentreader.core:fullrfid:9.3+@aar") {}
implementation("com.regula.idv:docreader:3.6.+@aar") {
isTransitive = true
}
// Required only if you're going to use Face SDK in your workflows
implementation("com.regula.face.core:basic:8.2+@aar") {}
implementation("com.regula.idv:face:3.6.+@aar") {
isTransitive = true
}
// main dependency
implementation("com.regula.idv:api:3.6.+@aar") {
isTransitive = true
}Sync Gradle after adding the dependencies.
- Using different version of Document Reader API SDK or Face API SDK
// By default, DocumentReader API included into docreader module of IDV.
// But you can change it to different version if you want use the latest version.
implementation("com.regula.documentreader:api:9.3.+@aar") {
isTransitive = true
}
// By default, Face API included into face module of IDV.
// But you can change it to different version if you want use the latest version.
implementation("com.regula.face:api:8.2.+@aar") {
isTransitive = true
}Ensure the following permissions and features are included:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-feature android:name="android.hardware.camera"
android:required="true" />
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required only if you're going to scan documents using Camera -->
<uses-permission android:name="android.permission.CAMERA"/>
<!-- Required only if you're going to read Rfid chip -->
<uses-permission android:name="android.permission.NFC" />
<!-- Required only if you're going to request user's location in a workflow -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
</manifest>In your MainActivity.kt, initialize the SDK with the Document Reader Module:
import com.regula.idv.api.IdvSdk
import com.regula.idv.docreader.DocReaderModule
import com.regula.idv.face.FaceModule
import com.regula.idv.api.config.InitConfig
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val config = InitConfig(listOf(DocReaderModule(), FaceModule())) // you can use both DocReader and Face module or only one when it's not required by workflow
IdvSdk.instance().initialize(context, config) {
// Handle initialization result
}
}
}Before using the SDK, configure the API connection. There are 3 ways to configure the API connection:
Using credentials
import com.regula.idv.api.config.CredentialsConnectionConfig
val URL = "https://..."
val USER_NAME = "your_username"
val PASSWORD = "your_password"
IdvSdk.instance().configure(context, CredentialsConnectionConfig(URL, USER_NAME, PASSWORD, IS_SECURE)) {
it.onSuccess {
// handle success
}
it.onFailure { exception ->
// handle errors
}
}Using token
Use this way when you have url with already defined auth key. In the result you will get a list of workflows id that you can perform.
import com.regula.idv.api.config.TokenConnectionConfig
val URL = "https://.../mobile?authorization=Token%20tr-pn7u6f5wizj9l7fnx4nzu8pqrnlwr&sessionId=68a72388660070d96275a8c2"
IdvSdk.instance().configure(context, TokenConnectionConfig(URL)) {
it.onSuccess { workflows ->
// handle success
}
it.onFailure { exception ->
// handle errors
}
}Using Api Key
import com.regula.idv.api.config.ApiKeyConnectionConfig
val URL = "https://..."
val API_KEY = "yprpwttipracqerersuzzrs_fbptvhtoczfjbx9azn8w3lzioddacyw3slfvoq3"
IdvSdk.instance().configure(context, ApiKeyConnectionConfig(URL, API_KEY)) {
it.onSuccess {
// handle success
}
it.onFailure { exception ->
// handle errors
}
}import com.regula.idv.api.config.PrepareWorkflowConfig
val workflowId = "your_workflow_id"
IdvSdk.instance().prepareWorkflow(context, PrepareWorkflowConfig(workflowId)) {
it.onSuccess {
// handle success
}
it.onFailure { exception ->
// handle errors
}
}IdvSdk.instance().startWorkflow(context) {
it.onSuccess { workflowResult ->
Log.d("IDV", "sessionId: ${workflowResult.sessionId}")
}
it.onFailure { exception ->
// handle errors
}
}import com.regula.idv.api.config.StartWorkflowConfig
val metadata = JSONObject()
metadata.put("key1", "value1")
val config = StartWorkflowConfig.Builder()
.setMetadata(metadata)
.build()
IdvSdk.instance().startWorkflow(context, config) {
it.onSuccess { workflowResult ->
Log.d("IDV", "sessionId: ${workflowResult.sessionId}")
}
it.onFailure { exception ->
// handle errors
}
}import com.regula.idv.api.config.StartWorkflowConfig
val config = StartWorkflowConfig.Builder()
.setLocale("de")
.build()
IdvSdk.instance().startWorkflow(context, config) {
it.onSuccess { workflowResult ->
Log.d("IDV", "sessionId: ${workflowResult.sessionId}")
}
it.onFailure { exception ->
// handle errors
}
}If you used metadata when you start workflow, from 2.4 version you should use IdvStartWorkflowConfig config.
See example:
val metadata = JSONObject()
metadata.put("key1", "value1")
val scenarioConfig = IdvStartWorkflowConfig.Builder()
.setMetadata(metadata)
.build()
IdvSdk.instance().startWorkflow(this, scenarioConfig) { sessionResult, error ->
if (error == null) {
// Handle successful verification
} else {
// Handle error
}
}IdvInitConfigrenamed toInitConfig.IdvConnectionConfigrenamed toCredentialsConnectionConfig. Also, now the first parameter is full url that includes http schema (http or https). You don't need to put IS_SECURE parameter anymore.IdvPrepareWorkflowConfigrenamed toPrepareWorkflowConfig.IdvStartWorkflowConfigrenamed toStartWorkflowConfig.- changed completion in
startWorkflowmethod. Now it returnsResult<WorkflowResult>object.
- no updates require
- no updates require
- no updates require
- no updates require
- Ensure all necessary dependencies are included in
build.gradle.kts. - Handle API failures by checking the
workflowResultandexceptioncallbacks. - Grant camera permissions before starting the workflow.
- Use proper configuration when establish connection to the platform.
This guide provides all necessary steps to integrate the Regula IDV SDK into an Android application. By following these instructions, developers can build a document verification feature using Regula’s technology.
For further details, refer to the official Regula IDV SDK documentation or contact support team.