Liveness Detection flutter SDK

A liveness detection Flutter plugin for iOS and Android. (Android 3.4.1, iOS V3.4.1)

Demo

Android

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

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 and motion sensor (gyroscope) 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:

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. Customize the number and sequence of actions.

  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:

CodeExplanation
FAIL_REASON_FACEMISS_BLINK_MOUTHFace loss during detection process
FAIL_REASON_FACEMISS_POS_YAWFace loss during detection process
FAIL_REASON_MUTI_FACEMultiple faces detected
FAIL_REASON_MUCH_ACTIONExcessive movement range during detection
FAIL_REASON_TIMEOUTAction timeout
FAIL_REASON_PREPARE_TIMEOUTPreparation timeout
NETWORK_REQUEST_FAILEDNetwork request failed
DEVICE_NOT_SUPPORTThe device has no front camera or is unavailable