Android 3D Liveness Detection SDK (v3.4.1) User Guide(For KMM)

Development Preparation

  1. Contact us to register an account.

Overview

Migration Guides

  1. Starting from version 1.3.9, the SDK supports online repository dependencies. We recommend using the online dependency for better convenience and flexibility.

  2. We have fixed some potential crashes on certain Android 12 devices in version 1.3.9.5. If your current version is lower than this, we recommend upgrading to this version to address the issue.

  3. We have addressed some issues detected by the VirusTotal platform. If your promotion relies on the detection results from this platform, please upgrade your SDK version to

    • 2.1.7 or above (for action liveness)
    • 3.0.9 or above (for 3D liveness)
  4. Starting from version 2.0.0, we have introduced ellipse dashed guidance during the preparation stage. Additionally, we have upgraded the network security policies and updated the SDK models.

  5. From version 3.0.0, SDK Interaction Method Changed to Near-Far Range Detection Mode,motion detection has been removed, so the properties and methods related to motion detection will not have any effect.

  6. We recommend you read the change logs to see what has been updated in the new version of the SDK.

Demo

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

Installation

SDK Version Updates

Usage

  1. Initialization SDK.

    The init method need to be called in your application class

  2. Check license

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

  3. Set the background color of the livenessView(do not overlay a mask image on the LivenessView, if you have, please remove it)

  4. Set the color of the oval frame in the livenessView:

  5. Capture audit images.

    When this feature is enabled, we will capture multiple images during the user's movement based on your configuration.

    Get audit images

  6. Video recording feature.

    By enabling this feature, the SDK will activate video recording. After the completion of the liveness process, you can retrieve the video file using SDK methods. The video file format is .mp4. Please note that this video can only be obtained through the SDK and cannot be obtained from the backend. After using the video, it is up to you to decide whether to delete the local file.

    Get video file

  7. Set detection timeout duration.

  8. Customize the size of the returned image

  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

  1. Start the liveness detection and obtain the result.

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

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

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

    • Important: After each liveness session, please make sure to save the eventId. If users have any questions or issues during the usage, please provide us with the eventId for troubleshooting. Without the eventId, it will be difficult to investigate the problem.

       

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_IAM_FAILED Authentication Error: Please ensure that the license has been initialized successfully.
WEAK_LIGHTliveness_weak_lightThe light is too weak
STRONG_LIGHTliveness_too_lightThe light is too strong
AUTH_BAD_NETWORK Failed to authorize network
CHECKING_BAD_NETWORK Network failed to upload image
MODEL_ERROR Model error
ALREADY_INIT Repeated loading
NO_UPLOAD_IMAGE Failed to capture the best uploaded image
AUTH_TICKET_DISABLE Ticket is expired
AUTH_ACCOUNT_ACCESS_DENIED Access for this account is denied
...(Other server side error codes)  

Customizable UI

The SDK provides access to the source code of the UI module, allowing you to customize the UI according to the following conditions.

  1. Keep the LivenessView as a square.
  2. Do not overlay any obstructions/masks on top of the LivenessView.

FAQ

  1. Multilingual

    Currently SDK supports these languages/voice: English, Indonesian, Chinese,Vietnamese,Hendi,Thai.Automatically switch according to the current language of the mobile phone, no code setting is required.

    • The default language for the SDK is English. If it is not consistent with the default language of your app, please manually find the resource in "liveness/res" that corresponds to your app's default language and replace the default resource with it.

    • 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

  2. Code proguard configuration

    Please add the following code to your app's proguard file:

  3. 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: