Minimum Android version:4.4 (API Level:19)
Compilation Android SDK version:API Level:33
Additional dependent third-party libraries: None
Supported CPU architectures:armeabi-v7a
,arm64-v8a
SDK package size: 1.3MB
model file + about 1MB
per CPU architecture
Capture image size: default capture image resolution 600px*600px
, size is about 300KB
, support custom image size range: 300px~1000px
Supported languages:
Use-permissions:
xxxxxxxxxx
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
Install CV-Demo.apk to your phone and log in with the test account.
https://public-n3.advai.net/repository/nuget-hosted/
AdvanceAI.Android.Liveness
Initialization SDK.
xxxxxxxxxx
// 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.
GuardianLivenessDetectionSDK.Init(Application,your market,false);
Let the SDK handle camera permissions
xxxxxxxxxx
GuardianLivenessDetectionSDK.LetSDKHandleCameraPermission();
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
xxxxxxxxxx
GuardianLivenessDetectionSDK.SetDetectionLevel(GuardianLivenessDetectionSDK.DetectionLevel.Normal);
Check license
The license is obtained by your server calling our openAPI, you need to check license before starting the liveness detection activity.
xxxxxxxxxx
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
}
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.
Important Note to Order of Motions
The default action sequence is [Blink]->[Shake Head]. To customize, you can follow one of the methods:
xxxxxxxxxx
// the first boolean value indicates if the given actions should be shuffled.
GuardianLivenessDetectionSDK.SetActionSequence(true,Detector.DetectionType.PosYaw,Detector.DetectionType.Blink,Detector.DetectionType.Mouth);
Customize the size of the returned image
xxxxxxxxxx
// Settable input range: [300,1000], unit: pixels
GuardianLivenessDetectionSDK.SetResultPictureSize(600);
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.
xxxxxxxxxx
GuardianLivenessDetectionSDK.CapturePictureQueue(true);
Obtain image sequence (obtained after successful live detection):
xxxxxxxxxx
IList<String> imageSequenceList = LivenessResult.ImageSequenceList;
Customized action time
Detection time for custom actions, all actions take effect after setting, unit: Millisecond
xxxxxxxxxx
GuardianLivenessDetectionSDK.SetActionTimeoutMills(10000);
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.
xxxxxxxxxx
GuardianLivenessDetectionSDK.BindUser(String userId)
Turn on occlusion detection
If you want to enable occlusion detection, please call the following method after initializing the SDK to set it
xxxxxxxxxx
GuardianLivenessDetectionSDK.IsDetectOcclusion(true)
errorCode | raw native sdk code | Description |
---|---|---|
PREPARE_TIMEOUT | fail_reason_prepare_timeout | Timeout during the preparation stage |
ACTION_TIMEOUT | fail_reason_timeout | Timeout during the motion stage |
MULTIPLE_FACE | fail_reason_muti_face | Multiple faces detected during the motion stage |
FACE_MISSING | fail_reason_facemiss_blink_mouth | Face is missing during the motion stage(blink or open mouth) |
FACE_MISSING | fail_reason_facemiss_pos_yaw | Face is missing during the motion stage(pos yaw) |
MUCH_ACTION | fail_reason_much_action | Multiple motions detected during the motion stage |
USER_GIVE_UP | user_give_up | The user clicked the top left back button during the detection process |
NO_RESPONSE | Network request failed | |
DEVICE_NOT_SUPPORT | device_not_support | The 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_LIGHT | liveness_weak_light | The light is too weak |
STRONG_LIGHT | liveness_too_light | The 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) |
Not supported.
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..
Code proguard configuration
The SDK already has code proguard, no additional configuration is required.