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.
  • 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​

  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
    intent.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:

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.