Identification

Start the identification process by calling IdentificationActivity.startForResult in your activity. This method internally prepares Intent for the identification process and starts that activity:

Java
Kotlin
Java
DocumentIdentificationResult.Type[][] documentTypes = new DocumentIdentificationResult.Type[][] {
{
DocumentIdentificationResult.Type.PASSPORT,
DocumentIdentificationResult.Type.DRIVERS_LICENSE,
DocumentIdentificationResult.Type.NATIONAL_ID
}
};
IdentificationActivity.startForResult(activity,
MY_REQUEST_CODE,
null,
"<client id>",
"<client secret>",
documentTypes
);
Kotlin
val documents = arrayOf(
arrayOf(
DocumentIdentificationResult.Type.PASSPORT,
DocumentIdentificationResult.Type.NATIONAL_ID,
DocumentIdentificationResult.Type.DRIVERS_LICENSE
)
)
IdentificationActivity.startForResult(activity,
REQUEST_CODE_IDENTIFICATION,
null,
"<client id>",
"<client secret>",
documents
)

Alternatively, you can start the activity with an assigned custom style (see Customization for more details):

Java
Kotlin
Java
DocumentIdentificationResult.Type[][] documentTypes = new DocumentIdentificationResult.Type[][] {
{
DocumentIdentificationResult.Type.PASSPORT,
DocumentIdentificationResult.Type.DRIVERS_LICENSE,
DocumentIdentificationResult.Type.NATIONAL_ID
}
};
IdentificationActivity.startForResult(activity,
MY_REQUEST_CODE,
null,
"<client id>",
"<client secret>",
documentTypes,
styleResourceId
);
Kotlin
val documents = arrayOf(
arrayOf(
DocumentIdentificationResult.Type.PASSPORT,
DocumentIdentificationResult.Type.NATIONAL_ID,
DocumentIdentificationResult.Type.DRIVERS_LICENSE
)
)
IdentificationActivity.startForResult(activity,
REQUEST_CODE_IDENTIFICATION,
null,
"<client id>",
"<client secret>",
documents,
styleResourceId
)

onActivityResult will be called in your activity after onboarding is either finished or canceled. Here you can get the onboarding result and process it:

Java
Kotlin
Java
@Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
if (requestCode == MY_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
final IdentificationResult resul = IdentificationActivity.getResult(data)
// process onboarding result
} else {
// process is canceled by user
final Throwable error = IdentificationActivity.getError(data);
if(error != null) {
// process error
}
}
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
Kotlin
override fun onActivityResult(
requestCode: Int,
resultCode: Int,
data: Intent?)
{
if (requestCode == REQUEST_CODE_IDENTIFICATION) {
if (data == null) return
if (resultCode == Activity.RESULT_OK) {
IdentificationActivity.getResult(data)?.let { result ->
// process onboarding result
}
} else {
IdentificationActivity.getError(data)?.let { error ->
// process error
}
}
} else {
super.onActivityResult(requestCode, resultCode, data)
}
}