Android-SDK-Liveness Detection(2D)

Demo

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

Integrate the SDK into your project

SDK Version Updates

Quick Start

  1. Initialization SDK.

    // The last boolean value represents whether the Global service is enabled or not, and is set to true if it is, or false if it is not.
    // The init method need to be called in your application class 
    GuardianLivenessDetectionSDK.init(this,your market,false);
  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

    GuardianLivenessDetectionSDK.setDetectionLevel(GuardianLivenessDetectionSDK.DetectionLevel.EASY);
  3. Check license

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

    String license = "xxx";
    String checkResult = GuardianLivenessDetectionSDK.setLicenseAndCheck(license);
    if ("SUCCESS".equals(checkResult)) {
        // license valid
       startLivenessActivity();
    } else {
        // license is not available, expired/wrong format/appId not filed
    }
  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.

  5. Important Note to Order of Motions

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

    // the first boolean value indicates if the given actions should be shuffled.
    GuardianLivenessDetectionSDK.setActionSequence(true,Detector.DetectionType.POS_YAW, Detector.DetectionType.MOUTH, Detector.DetectionType.BLINK);
  6. Customize the size of the returned image

    // Settable input range: [300,1000], unit: pixels
    GuardianLivenessDetectionSDK.setResultPictureSize(600);
  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.

    GuardianLivenessDetectionSDK.capturePictureQueue(true);

    Obtain image sequence (obtained after successful live detection):

    List<String> imageSequenceList = LivenessResult.getImageSequenceList();
  8. Customized action time

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

    GuardianLivenessDetectionSDK.setActionTimeoutMills(10000);
  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.

    GuardianLivenessDetectionSDK.bindUser(String userId)
  10. Turn on occlusion detection

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

    GuardianLivenessDetectionSDK.isDetectOcclusion(true)
  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..

  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.

    <uses-feature android:name="android.hardware.camera" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
  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:

    android.enableJetifier=true 
  16. SDK Compatibility


Error Code:

code
FACE_MISSING
ACTION_TIMEOUT
MULTIPLE_FACE
MUCH_MOTION
AUTH_BAD_NETWORK
CHECKING_BAD_NETWORK
DEVICE_NOT_SUPPORT
USER_GIVE_UP
UNDEFINED
NO_RESPONSE
AUTH_PARAMETER_ERROR
AUTH_IAM_FAILED