Skip to main content

Receiving the result

The SDK returns the capture result through callbacks defined in the listener interface used during the capture session.

UnicoSelfie
onSuccessSelfie

Called when the image is captured successfully. Returns a ResultCamera object with:

  • base64 — captured image; can be used to display a preview in your application.
  • encrypted — JWT payload that must be sent to your backend to complete biometric validation via the REST API.
@override
void onSuccessSelfie(ResultCamera result) {
final base64 = result.base64;
final encrypted = result.encrypted; // JWT to send to your backend
}
encrypted usage
  • The encrypted attribute is strictly intended for sending the image through the by Client APIs. It must not be opened or serialized — its characteristics may change without prior notice. Unico is not responsible for any damages resulting from improper handling.
  • The base64/encrypted files may vary in size depending on device quality, generated photo size, and Unico's business rules. Do not limit the size of the string generated by the SDK in your programming logic or infrastructure.
Base64 to bitmap (Android)

If you need to convert base64 to a bitmap, the standard method does not work directly on Android — split the string at the comma (,) first. See How to convert a Base64 string into a Bitmap image to show it in an ImageView?.

onErrorSelfie

Called when an error occurs during capture. Returns a UnicoError object with getCode() and getDescription(). See Error handling for the full list of error codes.

@override
void onErrorSelfie(UnicoError error) {
final code = error.getCode();
final description = error.getDescription();
}
UnicoDocument
onSuccessDocument

Called when the document image is captured successfully. Returns a ResultCamera object with:

  • base64 — captured image; can be used to display a preview.
  • encrypted — JWT payload that must be sent to your backend within 10 minutes and must never be modified or deserialized.
@override
void onSuccessDocument(ResultCamera result) {
final base64 = result.base64;
final encrypted = result.encrypted; // JWT to send to your backend
}
onErrorDocument

Called when an error occurs during document capture. Returns a UnicoError object. See Error handling for the full list of error codes.

@override
void onErrorDocument(UnicoError error) {
final code = error.getCode();
final description = error.getDescription();
}