Welcome to IDV Platform Android Documentation!
Introduction
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.
Prerequisites
Before integrating the SDK, ensure the following:
- Android Target SDK 34 recommended
- Camera permission enabled
- NFC permission enabled
- Internet permission enabled
- Regula IDV SDK dependency added to
build.gradle.kts
The SDK includes multiple modules (Document Reader SDK, Face SDK). Include only the modules required for your Workflow and follow their specific setup instructions.
Add Regula SDK to Gradle
- Add Regula's Maven repository URL in your
build.gradle.kts
file:
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/Regula
folder. -
Enable view and data binding features in your app-level
build.gradle.kts
by adding toandroid
section:
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 the Document Reader SDK in your workflows
implementation("com.regula.documentreader.core:fullrfid:8.2+@aar") {}
implementation("com.regula.idv:docreader:3.1.+@aar") {
isTransitive = true
}
// Required only if you're going to use the Face SDK in your workflows
implementation("com.regula.face.core:basic:7.1+@aar") {}
implementation("com.regula.idv:face:3.1.+@aar") {
isTransitive = true
}
// main dependency
implementation("com.regula.idv:api:3.1.+@aar") {
isTransitive = true
}
Sync Gradle after adding the dependencies.
Update AndroidManifest.xml
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 a camera -->
<uses-permission android:name="android.permission.CAMERA"/>
<!-- Required only if you're going to read an RFID chip -->
<uses-permission android:name="android.permission.NFC" />
</manifest>
Initialize Regula IDV SDK
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 modules, or only one when it's not required by the workflow
IdvSdk.instance().initialize(context, config) {
// Handle initialization result
}
}
}
Configure API Settings
Before using the SDK, configure the API connection. There are three 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 method when you have a URL with a predefined authentication key. The result will provide a list of workflow IDs 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
}
}
Prepare and Start an ID Verification Workflow
Prepare workflow before starting verification
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
}
}
Start workflow with default parameters when ready
IdvSdk.instance().startWorkflow(context) {
it.onSuccess { workflowResult ->
Log.d("IDV", "sessionId: ${workflowResult.sessionId}")
}
it.onFailure { exception ->
// handle errors
}
}
Set up metadata before starting workflow
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
}
}
With specific language
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
}
}
Best Practices & Troubleshooting
- Ensure all necessary dependencies are included in
build.gradle.kts
. - Handle API failures by checking the
workflowResult
andexception
callbacks. - Grant camera permissions before starting the workflow.
- Use proper configuration when establishing a connection to the Platform.