DocumentScannerActivity
Signature | Description |
---|---|
public class DocumentScannerActivity extends AppCompatActivity | A class used to start the document scanner and return the scanned results back to the application. |
Class constants
K_DOCUMENT_SCAN_TYPE: DocumentScannerType
K_DVC_ID: Document verification ID defines the configuration to be used for scanning and verification.
Prerequisites
The application must request and be granted camera permission before starting the document scan.
Initializing the Scanner and Retrieving Results
-
Create an ActivityResultLauncher to handle the result returned from the scanner activity.
ActivityResultLauncher<Intent> documentSessionResult =
registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
if (result.getResultCode() == RESULT_CANCELED) {
// Error
return;
}
if (result.getResultCode() == RESULT_OK) {
// Success
}
}); -
Start
DocumentScannerActivity
using anActivityResultLauncher
to receive the scan results.Intent intent = new Intent(this, DocumentScannerActivity.class);
intent.putExtra(K_DOCUMENT_SCAN_TYPE, DocumentScannerType.DL.getValue());
intent.putExtra(K_DVC_ID, "String DVCID"); // Optional
documentSessionResult.launch(intent);
Document Scanning Result Object
The result returned by DocumentScannerActivity
contains the scanned document data, along with any relevant metadata or status information.
{
"data": {
"responseStatus": "String", // SUCCESS OR FAILED
"sessionId": "String", // Session ID
"dl_object": {
// Driver License object
},
"ppt_object": {
// Passport object
},
"idcard_object": {
// IDCard object
},
"liveid_object": {
// LiveID Object
},
"token": "string" // document.proof_jwt
}
}
All documents—both Identity and Miscellaneous—must include the following baseline attributes:
Type | Parameter | Description |
---|---|---|
string | id | Represents the document's unique ID (e.g., driver's license number) |
string | category | Specifies the type of document being registered. The SDK currently supports two categories. - identity_document - misc_document |
string | type | Represents the type of document that the user will try to register eg: dl, ppt, nationalid. |
string | proofedBy | This identifies the entity responsible for proofing the document. |
The identity documents must have the following baseline attributes:
Type | Parameter | Description |
---|---|---|
string | firstName | First name of the document holder. |
string | lastName | Last name of the document holder. |
string | dob | Date of birth {yyyyMMdd} of the document holder. |
string | doe | Date of expiry {yyyyMMdd} of document. |
string | face | Base64 string of document holder's face photo. |
string | image | Base64 string of document image. |