Quick start
This guide shows you how to run a verification in your Android app with our default screens.
The SDK doesn't create transactions.
Your backend creates the transaction with the Agent API, and passes the sdkConfiguration from the response to your app.
Your app passes it to the SDK, which runs the verification from there.
Prerequisites
- A workflow and its ID.
- A backend endpoint that creates a transaction with
"platform": "Android"and returns itssdkConfiguration. Read Backend. - An app with a minimum SDK level of 26 or higher. Read Device requirements.
Installation
Add the Microblink Maven repository to your settings.gradle.kts:
dependencyResolutionManagement {
repositories {
maven { url = uri("https://maven.microblink.com") }
}
}
Then add the SDK, and the scanning SDKs that your workflows need, to your app's build.gradle.kts.
The BOM sets the versions of all of them:
dependencies {
implementation(platform("com.microblink:microblink-platform-bom:2.0.0"))
implementation("com.microblink:microblink-platform")
// Only the ones your workflows need:
implementation("com.microblink:blinkid-verify-ux") // document scanning
implementation("com.microblink:blinkcard-ux") // card scanning
implementation("com.microblink:biometrics-ux") // face capture
}
If a workflow has a step whose scanning SDK your app doesn't include, the verification fails with EngineError.MissingScannerSdk.
Read Add the SDK.
Run a verification
Get the sdkConfiguration from your backend, and pass it to MicroblinkPlatform.startVerification.
The SDK opens its own activity for the verification screens, and reports the outcome to your listener when the user leaves them.
This example logs the outcome to Logcat:
// sdkConfiguration is the value your backend got from POST /api/v2/transaction.
MicroblinkPlatform.startVerification(
activity = this,
configuration = MicroblinkPlatformConfiguration(
engine = EngineConfiguration(
service = ServiceSettings(sdkConfiguration = sdkConfiguration)
),
resultListener = object : MicroblinkPlatformResultListener {
override fun onVerificationFinished(outcome: SessionOutcome.Verification) {
Log.d("MBP", "Transaction ${outcome.transactionId}: ${outcome.state}")
}
override fun onVerificationCanceled(outcome: SessionOutcome.Canceled) {
Log.d("MBP", "User canceled: ${outcome.reason}")
}
override fun onVerificationFailed(transactionId: String?, error: EngineError) {
Log.d("MBP", "Verification failed: $error")
}
}
)
)
Exactly one of the three listener methods is called for each verification.