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.
- K_UID : Unique ID by using it, you can filter sessions in AdminX → Verifications section.
- K_DOCUMENT_SCAN_ERROR : String extra key used to retrieve the error message when document scanning fails. If the scanning activity returns RESULT_CANCELED, the error details can be obtained from the result Intent using getStringExtra(K_DOCUMENT_SCAN_ERROR).
Prerequisites
The application must grant the 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) {// Errorreturn;}if (result.getResultCode() == RESULT_OK) {// Success}}); -
Start
DocumentScannerActivityusing anActivityResultLauncherto 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"); // Optionalintent.putExtra(K_UID, "String UID"); // Optional UID (Unique ID by using it you can filter in AdminX→Verifications).intent.putExtra(K_ENABLE_SCREEN_PROTECTION, true); // An optional boolean flag to enable screenshot and screen recording prevention.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": {
"sessionResult": "String", // SUCCESS OR FAILED
"sessionId": "String", // Session ID
"document": {
// Driver License object
// Passport object
// IDCard object
},
"liveId": {
// 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. |