Skip to main content

Handling Responses

To obtain the FaceReconResponse object, which contains the results of captures obtained by the SDK, including the identifiers of images sent to the QI Tech system, override the onActivityResult method in the same activity where you started FaceReconActivity:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE) {
if (resultCode == RESULT_OK && data != null) {
faceReconResponse = data.getParcelableExtra("FaceReconResponse");
image_key = faceReconResponse.image_key;
device_scan_session_id = faceReconResponse.device_scan_session_id;
Log.i(TAG_LIVENESS, "FACE RECON RESPONSE: " + faceReconResponse.image_key);
}
else if (resultCode == RESULT_CANCELED && data != null) {
faceReconResponse = data.getParcelableExtra("FaceReconResponse");
Log.i(TAG_LIVENESS, "FACE RECON RESPONSE: " + faceReconResponse.status_code + " - " + faceReconResponse.reason + " - " + faceReconResponse.description);
}
}
}

Description of FaceReconResponse Object Attributes

Warning:

Device Scan Integration Starting from version 5.2.0, the Face Recognition service will automatically perform an internal call to Device Scan. With this, the success response will include the device_scan_session_id field. This key identifies the device scan session performed internally and can be used in an integrated manner in other QI Tech ecosystem services.

AttributeDescriptionResultVersions
image_keyIdentification key of the provided image that can be used in any other QI Tech system service.RESULT_OKAll
device_scan_session_idIdentification key of the device scan session performed internally that can be used in any other QI Tech system service.RESULT_OK5.2.0+
status_codeRequest status code.RESULT_CANCELED5.0.0+
reasonError identifierRESULT_CANCELED5.0.0+
descriptionError description.RESULT_CANCELED5.0.0+

Error Structure (SDK 5.0.0+)

Important Warning!

Starting from version 5.0.0, the error structure has been reformulated to provide more detailed and diagnostic information.

Example: InvalidToken

{
status_code = 401
reason = "INVALID_TOKEN"
description = "Authentication token expired or invalid"
}

Example: UserCanceled

{
status_code = 0
reason = "USER_CANCELED"
description = "User pressed the back button."
}

Previous Versions

    @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
FaceRecognition.RequestResponseObject result;
if (requestCode == REQUEST_CODE){
if (resultCode == RESULT_OK && data != null){
faceReconResponse = data.getParcelableExtra("FaceReconResponse");
}
}
}