Skip to main content

DocumentScannerActivity

SignatureDescription
public class DocumentScannerActivity extends AppCompatActivityA 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

  1. 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
    }
    });

  2. Start DocumentScannerActivity using an ActivityResultLauncher 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:

TypeParameterDescription
stringidRepresents the document's unique ID (e.g., driver's license number)
stringcategorySpecifies the type of document being registered. The SDK currently supports two categories.
- identity_document
- misc_document
stringtypeRepresents the type of document that the user will try to register eg: dl, ppt, nationalid.
stringproofedByThis identifies the entity responsible for proofing the document.

The identity documents must have the following baseline attributes:

TypeParameterDescription
stringfirstNameFirst name of the document holder.
stringlastNameLast name of the document holder.
stringdobDate of birth {yyyyMMdd} of the document holder.
stringdoeDate of expiry {yyyyMMdd} of document.
stringfaceBase64 string of document holder's face photo.
stringimageBase64 string of document image.