Quick start
Quick start guide for the DocIDV Android SDK.
Starting the SDK
Here is an example of how to launch the SDK from your host app:
- First, initialize the SDK
fun initSDK() {
val idnowConfig = IDnowDocIDVConfig.Builder()
.withLanguage("en") // set specific ISO language code
.withHttpLogging(true)
.build()
IDnowDocIDV.getInstance().initialize(this, idnowConfig)
}
Using withLanguage("lang_code") you can configure the IDnow library to use a specific language. Use the ISO 639-1 language code of one of our supproted languages.
Best Practice: Our recommended best practice for optimal user experience is to allow the SDK to use the device language instead of setting a specific lang_code.
Language Limitations: Some components that rely on 3rd party technologies such as Biometric Liveness or NFC scanning do not support dynamic localization and use the device language.
- Then, start the SDK
idnowDocIDV?.start(args.identToken, object : IDnowDocIDV.ResultListener {
override fun onIdentResult(iDnowDocIDVResult: IDnowDocIDVResult) {
// handle result
}
})
This code calls the main start method to launch the DocIDV library. It takes several parameters:
| Parameter | Type | Description |
|---|---|---|
| token | String | The identification token provided for the session. |
| listener | ResultListener | A callback used to receive the result of the identification session, providing a result type and a status code. |
Handling the Result
Ensure the SDK is started with the listener callback to handle the session's outcome:
when (iDnowDocIDVResult.resultType) {
IDnowDocIDVResult.ResultType.FINISHED -> {
// Ident completed successfully
handleIdentificationSuccess()
}
IDnowDocIDVResult.ResultType.CANCELLED -> {
// Ident was canceled
handleIdentificationCanceled(cancelReason = iDnowDocIDVResult.statusCode)
}
IDnowDocIDVResult.ResultType.ERROR -> {
// Ident has an error
handleIdentificationError(errorCode = iDnowDocIDVResult.statusCode)
}
}
Handling errors
In case of IDnowDocIDVResult.ResultType.ERROR, the IDnowDocIDVResult.getStatusCode() method returns one of the error codes below:
E100— Ident code syntax incorrectE101— Ident code not foundE102— Ident code expiredE103— Ident code already completedE130— Get ident resources failed; invalid responseE131— Get ident resources failed; server reachabilityE150— Start ident failed; invalid responseE151— Start ident failed; server reachabilityE152— Start ident failed; missing session keyE160— Process force closedE170— Socket connection force closedE171— Process force closed- `E180 — Missing application context
Handling Specific Errors
- For
E102(Token expired), it is recommended to request a new identification token and restart the process. - For
E103(Already completed), it is recommended to inform the user that they have already submitted all required information and should wait for the final result. - For
E170(Timeout), it is recommended to notify the user that the session timed out or was started on a different device and ask them to try again. - For
E180This is to alert the host app if the context has been lost (OS restarted/killed SDK process). - For all other error codes, it is recommended to show a generic error message and ask the user to try restarting the process.