From 4.0.0, we've introduced significant API improvements and feature enhancements. To make upgrading easier, here’s what you need to know:
Due to numerous API changes this time, if you haven't made significant changes to the LivenessActivity.java code, it's recommended that you re-download the UI source code module and its dependencies.
GuardianLivenessDetectionSDKDue to the presence of different types of initialization methods in the SDK, the parameters of the initmethod have grown increasingly numerous, making it difficult to understand their meanings. Therefore, starting from version 4.1.0, we have redesigned the initmethod. Please select the corresponding initmethod based on your current initialization approach.
License Authentication Method:
GuardianLivenessDetectionSDK.init(new SDKLicenseAuthModeConfig.Builder().setMarket(Market market).setIsGlobalService(boolean isGlobalService).build(), this);
Static AccessKey & SecretKey Authentication Method:
GuardianLivenessDetectionSDK.init(new SDKStaticKeyAuthModeConfig.Builder().setAccessKey("your access key").setSecretKey("your secret key").setMarket(Market market).setIsGlobalService(boolean isGlobalService).build(),this);
As the SDK evolves, the GuardianLivenessDetectionSDK has seen an increasing number of static methods with fragmented configurations. Therefore, starting from version 4.0.0, we have consolidated these configurations into LivenessConfig. You can refer to the table below for migration guidance.
| Method/Property | Alternative | Notes |
|---|---|---|
| setRecordVideoSwitch | - | No need to call. |
| letSDKHandleCameraPermission | - | No need to call. |
| setMaxRecordVideoSeconds | LivenessConfig#setMaxRecordVideoSeconds() | Record if greater than 0, otherwise recording. |
| setRecordVideoQuality | - | No need to call. |
| isDetectOcclusion | LivenessConfig#setDetectOcclusion() | - |
| setResultPictureSize | LivenessConfig#setResultPictureSize() | - |
| bindUser | LivenessConfig#setUserId() | - |
| set3DLivenessTimeoutMills | LivenessConfig#setDistantNearTimeout() | - |
| setActionSequence | - | No need to call. |
| setActionTimeoutMills | LivenessConfig#setActionTimeout() | - |
| setAuditImageConfig | LivenessConfig#setAuditImageConfig() | - |
| setCameraType | LivenessConfig#setCameraType() | - |
| setDetectionLevel | - | No need to call. |
| setDeviceType | - | Not support. |
| setPrepareTimeoutMills | LivenessConfig#setPrepareMillSeconds() | - |
| setSignatureId | LivenessConfig#setSignatureId() | - |
| setQueryId | LivenessConfig#setQueryId() | - |
| setTicket | LivenessConfig#setTicket() | - |
| clearTicketAndQueryId | - | LivenessConfig#setQueryId(""), LivenessConfig#setTicket("") |
| isSDKHandleCameraPermission | - | No need to call. |
LivenessViewTo accommodate various liveness types, we have adjusted some APIs of
LivenessViewand renamed DetectionType to LivenessStageto make its meaning more precise
| Method/Property | Alternative | Notes |
|---|---|---|
| setLivenssCallback | LivenessView$startDetection(configs, livenessCallback); | The set method has been removed, and configs and callback need to be set each time the liveness detection is started. |
| onResume | - | No need to call. |
| onPause | - | No need to call. |
| onDestroy | - | No need to call. |
| isNotOnLoadingFaceData | - | No need to call. |
| getLivenessData | - | No need to call. |
| playSound(resID, true, 1500); | LivenessConfig#setSoundRawId(), LivenessConfig#playSound() | The playSound method is divided into two methods: setSoundRawId for setting the resource ID and playSound for playing the sound. |
| getCurrentDetectionType | Removed | Liveness stage cannot be obtained from the view. Please retrieve the LivenessStage through the callback onLivenessStageChanged provided by the view. |
DetectorThe
Detectorclass is no longer visible, and the related enumerations are replaced as follows
| Method/Property | Alternative | Notes |
|---|---|---|
Detector.DetectionType | aai.liveness.enums.LivenessStage | - |
Detector.WarnCode | aai.liveness.enums.WarnCode | - |
Detector.DetectionFailedType | aai.liveness.enums.DetectionFailedType | - |
DetectionFailedType| Alternative | Method/Property | Notes |
|---|---|---|
| - | NO_BEST_IMAGE | A new error code has been added. It belongs to internal SDK errors and does not require user notification. Please contact us if this code appears. |
| - | UNDEFINED | A new error code has been added. It belongs to internal SDK errors and does not require user notification. Please contact us if this code appears. |
LivenessCallback| Method/Property | Alternative | Notes |
|---|---|---|
onDetectionActionChanged() | onLivenessStageChanged(LivenessStage livenessStage) | |
onDetectionFrameStateChanged(Detector.WarnCode warnCode) | onDetectionFrameStateChanged(LivenessStage livenessStage, WarnCode warnCode) | |
onDetectionFailed(Detector.DetectionFailedType failedType, Detector.DetectionType detectionType) | onDetectionFailed(DetectionFailedType failedType, LivenessStage livenessStage) | |
onDetectionSuccess() | Removed | New methods onUploadFaceDataStart and onUploadFaceDataComplete have replaced the onDetectionSuccess method. |
| - | onUploadFaceDataStart() | Start uploading face data; please execute your loading here. |
| - | onUploadFaceDataComplete() | Face data upload completed; hide your loading. You can obtain the results through LivenessResult. |
aai.liveness.impl.LivenessGetFaceDataCallbackRemoved