Skip to main content

Selfie Module

The selfie module basically contains three kinds of sub-modules. The main purpose is to upload the Selfie data received from the user to the server, just like in other modules, and to monitor the result. For this purpose, the user usage and integration of each module may differ. You can find the details below.

  • Manual : Sub-module that provides process the taken Selfie data from the user by pressing the button.

  • Auto : Sub-module that provides process the taking the Selfie data with the most suitable image quality if the user is in a suitable position.

  • Pose Estimation : Sub-module that provides process the Selfie data automatically taken at the most convenient moment of the user after the successful realization of the face positions requested from the user.

Uploading the selfie​

All three sub-modules share the same upload() method. It returns true when the upload succeeds.

// Manual selfie
final bool isSuccess = await AmaniSDK().getSelfie().upload();

// Auto selfie
final bool isSuccess = await AmaniSDK().getAutoSelfie().upload();

// Pose estimation
final bool isSuccess = await AmaniSDK().getPoseEstimation().upload();

Getting the documentId after the upload​

Starting with version 2.2.0, upload() accepts an optional onResult callback. When you pass it, the SDK also returns the documentId of the document that the upload created.

final bool isSuccess = await AmaniSDK().getSelfie().upload(
onResult: (isSuccess, documentId) {
if (isSuccess && documentId != null) {
// Upload succeeded, store the documentId
print("Selfie uploaded, documentId: $documentId");
} else {
// Upload failed, documentId is null
}
},
);

The same onResult callback is available on getAutoSelfie().upload() and getPoseEstimation().upload().

ParameterTypeDescription
isSuccessbooltrue when the upload succeeded.
documentIdString?The id of the created document. It is null when the upload failed.
note

If you don't pass onResult, upload() works exactly as before and only returns a bool. Check the requirements for the documentId flow.