Liveness Detection flutter SDK

A liveness detection Flutter plugin for iOS and Android. (Android V3.6.0, iOS V3.6.1)

Demo

Android

Install CV-Demo.apk on your phone and log in with the test account.

Migration Guide

Starting in version 3.6.0, error codes for the iOS Flutter plugin have been updated. Please ensure your code adapts to the new error codes when upgrading.

Integrate the SDK into your project

Click to download SDK

Android

  1. Copy liveness_plugin to the root directory of the project or the existing plugins folder in the project.

  2. Open the pubspec.yaml file in the root directory and add a reference to the liveness_plugin plugin under the dependencies node:

  3. Update the version of the dependency in the build.gradle file located in the liveness directory.

iOS

  1. Add camera usage description in Info.plist as bellow. Ignore this step if you have added those.

  2. Open the pubspec.yaml file in the root directory and add a reference to the liveness_plugin plugin under the dependencies node:

  3. Open your Podfile and specify the SDK name and url:

Compliance Explanation

Click to view the compliance explanation

Quick Start

  1. Declare the plugin.

  2. Initialize the SDK.

    The last parameter must match the category of the country to which your account belongs, otherwise you will not be authorized.

  3. Set license (call openAPI to obtain license by your server)

  4. Set SignatureId (optional feature; if this id is not set or is set to empty, the livenessId method will remain unchanged)

    In the following known situations, the livenessId generated by AAI may not be transmitted to your server, resulting in the loss of these livenessId outcomes. To address this issue, your backend can call the AAI interface to generate a SignatureId and pass it to the SDK. The SignatureId can be used to obtain the liveness score and has equivalent functionality to the livenessId.

    Please note: SignatureId can be empty but must not be reused

  5. Get the SDK version number.

  6. Start the liveness detection test and obtain the test result.

    Each time the liveness detection is successful, a unique livenessId and a clear photo of 600*600 pixels for this test will be returned.

    • You need to give the livenessId to your server, and the server will call openAPI to get the score of this test.

    • You can get the image directly through the methods provided by the SDK, or you can call the openAPI from the server.

  7. Read the latest results at anytime after the completion of the Liveness Detection(This feature is only supported on Android).

    You can get the result in the callback after the Liveness Detection is completed (step 5), or you can get it at any time through the following methods.

  8. User binding (strongly recommended).

    You can use this method to pass your user unique identifier to us, we will establish a mapping relationship based on the identifier。It is helpful for us to check the log when encountering problems.

  9. The code of the liveness module(for android) and the code of ios/Classes(for iOS) can be modified to meet the customization needs.

    Currently SDK supports six languages/voice: Chinese, English, Indonesian, Vietnamese,Hendi,Thai. Automatically switch according to the current language of the mobile phone, no code setting is required. If you only support one language, you can delete the resource files of other countries, for iOS side, you also need to modify the method currLanForBundle: to return a specific language.


Android Error Code:

CodeExplanationSolution
FACE_MISSINGFace loss during detection process/
ACTION_TIMEOUTAction timeout/
MULTIPLE_FACEMultiple faces detected/
MUCH_MOTIONExcessive movement range during detection/
AUTH_BAD_NETWORKAuthorization failed when requested the networkTry again after using VPN
CHECKING_BAD_NETWORKThe image uploading network request failed after the motion endedTry again after using VPN
DEVICE_NOT_SUPPORTThe device does not support liveness detectionThe device has no front camera or is unavailable
USER_GIVE_UPThe user interrupted the Liveness detection/
UNDEFINEDOther undefined errors/
NO_RESPONSERequest network failedCheck your network status.
AUTH_PARAMETER_ERRORAuthorization request parameter errorPlease check whether the key passed to the initialization method is SDK’s or not, and make sure that the Market matches.
AUTH_IAM_FAILEDPackage name not registeredSelf-configuration on SaaS (Personal Management -> ApplicationId Management) or contact us to add
WEAK_LIGHTThe light is too weak/
STRONG_LIGHTThe light is too strong/
MODEL_ERRORModel error/
ALREADY_INITRepeated loading/
NO_UPLOAD_IMAGEFailed to capture the best uploaded image/
AUTH_TICKET_DISABLETicket is expired/
AUTH_ACCOUNT_ACCESS_DENIEDAccess for this account is denied/
...(Other server side error codes)  

iOS Error Code:

Code(v3.6.0 and newer)Code(v3.5.0 and older)Explanation
FACE_MISSINGFAIL_REASON_FACEMISS_BLINK_MOUTHFace loss during detection process
FACE_MISSINGFAIL_REASON_FACEMISS_POS_YAWFace loss during detection process
MUTI_FACEFAIL_REASON_MUTI_FACEMultiple faces detected
MUCH_ACTIONFAIL_REASON_MUCH_ACTIONExcessive movement range during detection
/FAIL_REASON_TIMEOUTAction timeout (This error code never occurs in version 3.x.)
PREPARE_TIMEOUTFAIL_REASON_PREPARE_TIMEOUTPreparation timeout
USER_GIVE_UPUSER_GIVE_UPThe user clicked the top left back button during the detection process
NO_RESPONSE/Network request failed
DEVICE_NOT_SUPPORTDEVICE_NOT_SUPPORTThe device has no front camera or is unavailable
UNDEFINED/Other undefined errors
...(Other server side error codes)NETWORK_REQUEST_FAILED/