Android-SDK-Liveness Detection(2D)

###Demo

Method 1:

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

Method 2:

Download Demo Project

Integrate the SDK into your project

Download the UI module source code according to the type of Google library your project depends on, unzip it and copy the liveness folder to your project as a normal module for dependency.

SDK Version Updates

Quick Start

  1. Initialization SDK.

  2. Set movement difficulty level(Called before the setLicenseAndCheck() method, otherwise it does not take effect

    You can specify the difficulty of the action detection according to your business requirements (EASY,NORMAL,HARD),default level is NORMAL

  3. Check license

    The license is obtained by your server calling our openAPI, you need to check license before starting the liveness detection activity.

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

    The camera detection permission is not processed on the live detection page. Please do the permission detection before entering the page.
    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.

  5. Important Note to Order of Motions

    The default action sequence is [Blink]->[Shake Head]. To customize, you can follow one of the methods:

  6. Customize the size of the returned image

  7. Return multiple images (off by default)

    The SDK supports capturing a separate image for each action. If you turn this switch on, the SDK will run with a higher memory footprint due to the extra images being captured. If your App is already using a lot of memory, turning on this configuration may cause a memory overflow, so please choose carefully.

    Obtain image sequence (obtained after successful live detection):

  8. Customized action time

    Detection time for custom actions, all actions take effect after setting, unit: Millisecond

  9. 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.

  10. Turn on occlusion detection

    If you want to enable occlusion detection, please call the following method after initializing the SDK to set it

  11. Multilingual

    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 the SDK does not automatically switch with the system language, please check your cellphone language settings and make sure that both [Region] and [Language] are switched to the corresponding language.

    • If it still have problems with multiple languages and the app only supports one language, you can filter out the unwanted languages by adding the following configuration to build.gradle

  12. Runtime Permissions

    This SDK requires the following permissions, which have been configured in the aar manifest file and the SDK itself is ready for dynamic application of Android 6.0+ permissions.

  13. About App Bundle Bundling

    Please verify that the packaged APK will work on all architectures of cell phones. If you are prompted with [this device is not supported], it means that the .so file in .aar is missing when assembling the APK. Please contact us for a separate version of .so and .aar.

  14. Code proguard configuration

    The SDK already has code proguard, no additional configuration is required.

  15. About androidx

    Considering the mutually exclusive nature of AndroidX and android.support.* packages, all the .aar of this SDK are android.support.* packages. If your project is an AndroidX package and you encounter a android.support.* package conflict error when compiling, please add the following configuration to the gradle.properties file in the root directory of your project and recompile the project and you will be able to:

  16. SDK Compatibility

    • Minimum Android version:4.4 (API Level:19)
    • Compilation Android SDK version:API Level:32
    • Additional dependent third-party libraries: None
    • Supported CPU architectures:armeabi-v7aarm64-v8ax86x86_64armeabi
    • SDK package size: 1.3MB model file + about 0.8MB per CPU architecture
    • Capture image size: default capture image resolution 600px*600px, size is about 300KB, support custom image size range: 300px~1000px

Error code

errorCoderaw native sdk codeDescription
PREPARE_TIMEOUTfail_reason_prepare_timeoutTimeout during the preparation stage
ACTION_TIMEOUTfail_reason_timeoutTimeout during the motion stage
MULTIPLE_FACEfail_reason_muti_faceMultiple faces detected during the motion stage
FACE_MISSINGfail_reason_facemiss_blink_mouthFace is missing during the motion stage(blink or open mouth)
FACE_MISSINGfail_reason_facemiss_pos_yawFace is missing during the motion stage(pos yaw)
MUCH_ACTIONfail_reason_much_actionMultiple motions detected during the motion stage
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 front camera of this device cannot be opened
UNDEFINED Other undefined errors
AUTH_PARAMETER_ERROR Authentication Error: Please ensure that the license has been initialized successfully.
AUTH_BAD_NETWORK Authentication network request failed
AUTH_IAM_FAILED Authentication Error: Please ensure that the license has been initialized successfully.
...(Other server side error codes)