Android SDK
The Kora IDV Android SDK provides a complete verification UI — document capture, selfie, and liveness detection — built with Jetpack Compose.
Requirements
- Android API 24+ (Android 7.0)
- Kotlin 2.0.0+
- Jetpack Compose BOM 2024.02.00+
Installation
Gradle (Kotlin DSL)
Add the JitPack repository and dependency:
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
maven { url = uri("https://jitpack.io") }
}
}
// build.gradle.kts (app module)
dependencies {
implementation("com.github.korastratum:koraidv-android:1.1.0")
}
Gradle Version Catalog
# libs.versions.toml
[versions]
koraidv = "1.1.0"
[libraries]
koraidv = { module = "com.github.korastratum:koraidv-android", version.ref = "koraidv" }
// build.gradle.kts
dependencies {
implementation(libs.koraidv)
}
Quick start
1. Configure the SDK
import com.koraidv.sdk.KoraIDV
import com.koraidv.sdk.KoraIDVConfig
import com.koraidv.sdk.Environment
// In your Application class or Activity
KoraIDV.configure(
KoraIDVConfig(
apiKey = "test_your_api_key",
tenantId = "your-tenant-uuid",
environment = Environment.SANDBOX
)
)
2. Register for verification results
import com.koraidv.sdk.VerificationContract
import com.koraidv.sdk.VerificationRequest
import com.koraidv.sdk.VerificationResult
class VerifyActivity : ComponentActivity() {
private val verificationLauncher = registerForActivityResult(
VerificationContract()
) { result: VerificationResult ->
when (result) {
is VerificationResult.Success -> {
val status = result.verification.status
val score = result.verification.overallScore
val imagePersisted = result.verification.imagePersisted
// Handle success
}
is VerificationResult.Failure -> {
val error = result.error
// Handle error
}
is VerificationResult.Cancelled -> {
// User cancelled
}
}
}
}
3. Launch verification
// Create verification on your server first, then launch with the ID
verificationLauncher.launch(
VerificationRequest(
verificationId = "ver_abc123", // From your server
documentTypes = listOf("us_passport", "us_drivers_license"),
livenessMode = LivenessMode.ACTIVE
)
)
Resume an existing verification
verificationLauncher.launch(
VerificationRequest(
verificationId = existingVerificationId,
resumeExisting = true
)
)
Configuration options
| Parameter | Type | Default | Description |
|---|---|---|---|
apiKey | String | Required | Your API key (test_ for sandbox, live_ for production) |
tenantId | String | Required | Your tenant UUID |
environment | Environment | .SANDBOX | .SANDBOX or .PRODUCTION |
baseUrl | String? | null | Override base URL (for on-premise deployments) |
documentTypes | List<String> | All types | Restrict which document types are accepted |
livenessMode | LivenessMode | .ACTIVE | .ACTIVE (challenges) or .PASSIVE (auto-detect) |
theme | KoraTheme? | null | Custom theme colors and styling |
timeoutSeconds | Int | 300 | Session timeout in seconds |
Theme customization
import com.koraidv.sdk.KoraTheme
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
KoraIDV.configure(
KoraIDVConfig(
apiKey = "test_your_api_key",
tenantId = "your-tenant-uuid",
theme = KoraTheme(
primaryColor = Color(0xFF2563EB),
backgroundColor = Color.White,
textColor = Color(0xFF1F2937),
errorColor = Color(0xFFDC2626),
cornerRadius = 12.dp,
buttonHeight = 48.dp
)
)
)
Error handling
The SDK provides typed errors with recovery suggestions:
is VerificationResult.Failure -> {
when (result.error) {
is KoraException.NetworkError -> {
// Check internet connection
showRetryDialog(result.error.recoverySuggestion)
}
is KoraException.CameraAccessDenied -> {
// Request camera permission
requestCameraPermission()
}
is KoraException.SessionExpired -> {
// Create a new verification on your server
createNewVerification()
}
is KoraException.UserCancelled -> {
// User backed out
}
}
}
| Error | Description | Recovery |
|---|---|---|
NetworkError | Network request failed | Check connection, retry |
CameraAccessDenied | Camera permission denied | Request permission again |
SessionExpired | Verification session timed out | Create a new verification |
UserCancelled | User dismissed the verification | Prompt to try again |
Permissions
Add to your AndroidManifest.xml:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
The SDK requests camera permission at runtime if not already granted.
ProGuard rules
If using ProGuard or R8, add:
-keep class com.koraidv.sdk.** { *; }
-keepclassmembers class com.koraidv.sdk.** { *; }
Flutter bridge
If your Android host is part of a Flutter app:
// In your FlutterActivity
class MainActivity : FlutterActivity() {
private val CHANNEL = "com.yourapp/koraidv"
override fun configureFlutterEngine(flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, CHANNEL)
.setMethodCallHandler { call, result ->
when (call.method) {
"startVerification" -> {
val verificationId = call.argument<String>("verificationId")!!
verificationLauncher.launch(
VerificationRequest(verificationId = verificationId)
)
result.success(null)
}
else -> result.notImplemented()
}
}
}
}