Requirements
minSdk 24, compileSdk 35. The device needs an up-to-date Android System WebView.
Install
Take the android folder from the SDK archive and include the veriffy module as a source module:
// settings.gradle.kts
include(":veriffy")
project(":veriffy").projectDir = file("path/to/veriffy-sdk/android/veriffy")
// app/build.gradle.kts
dependencies {
implementation(project(":veriffy"))
}The library adds the INTERNET and CAMERA permissions to the manifest itself. R8/ProGuard rules are applied automatically.
Start
The recommended way is the activity-result contract:
class KycActivity : AppCompatActivity() {
private val verify = registerForActivityResult(VeriffyContract()) { result ->
when (result) {
is VeriffyResult.Completed -> showPending(result.status) // "approved", "review", "processing" …
is VeriffyResult.Cancelled -> showRetry()
is VeriffyResult.Failed -> when (result.error.code) {
VeriffyErrorCode.EXPIRED -> createNewSession()
VeriffyErrorCode.CAMERA_DENIED -> explainCamera()
else -> showError(result.error)
}
}
}
private fun startVerification() {
lifecycleScope.launch {
val url = backend.createVerificationSession() // your server: POST /v1/sessions
verify.launch(url)
}
}
}If you need events while the verification runs, use Veriffy.start(…) with an onEvent listener — there is an example in the README inside the android folder.
What the SDK does for you
- Asks for the camera permission at the moment the verification opens the camera.
- Grants the camera to the verification page only; never the microphone.
- If the user has blocked the camera permanently, shows a screen that leads to Settings.
- Keeps the result when the activity is re-created, for example on rotation.
- The Back button closes the verification and returns the result.
A blank screen or the webview_unavailable error
The device has no usable Android System WebView: it is disabled, missing or being updated. Ask the user to update "Android System WebView" or Chrome in Google Play.