Documentation

Migration Guides

From 4.0.0, we've introduced significant API improvements and feature enhancements. To make upgrading easier, here’s what you need to know:

Some APIs in the table below are now removed. You’ll need to update your code accordingly.

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.

GuardianLivenessDetectionSDK

Method/PropertyAlternativeNotes
setRecordVideoSwitch-No need to call.
letSDKHandleCameraPermission-No need to call.
setMaxRecordVideoSecondsLivenessConfig#setMaxRecordVideoSeconds()Record if greater than 0, otherwise recording.
setRecordVideoQuality-No need to call.
isDetectOcclusionLivenessConfig#setDetectOcclusion()-
setResultPictureSizeLivenessConfig#setResultPictureSize()-
bindUserLivenessConfig#setUserId()-
set3DLivenessTimeoutMillsLivenessConfig#setDistantNearTimeout()-
setActionSequence-No need to call.
setActionTimeoutMillsLivenessConfig#setActionTimeout()-
setAuditImageConfigLivenessConfig#setAuditImageConfig()-
setCameraTypeLivenessConfig#setCameraType()-
setDetectionLevel-No need to call.
setDeviceType-Not support.
setPrepareTimeoutMillsLivenessConfig#setPrepareMillSeconds()-
setSignatureIdLivenessConfig#setSignatureId()-
setQueryIdLivenessConfig#setQueryId()-
setTicketLivenessConfig#setTicket()-
clearTicketAndQueryId-LivenessConfig#setQueryId(""), LivenessConfig#setTicket("")
isSDKHandleCameraPermission-No need to call.

LivenessView

Method/PropertyAlternativeNotes
setLivenssCallbackLivenessView$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.
getCurrentDetectionTypeRemovedLiveness stage cannot be obtained from the view. Please retrieve the LivenessStage through the callback onLivenessStageChanged provided by the view.

Detector

The Detector class is no longer visible, and the related enumerations are replaced as follows

Method/PropertyAlternativeNotes
Detector.DetectionTypeaai.liveness.enums.LivenessStage-
Detector.WarnCodeaai.liveness.enums.WarnCode-
Detector.DetectionFailedTypeaai.liveness.enums.DetectionFailedType-

DetectionFailedType

AlternativeMethod/PropertyNotes
-NO_BEST_IMAGEA 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.
-UNDEFINEDA 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/PropertyAlternativeNotes
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()RemovedNew 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.LivenessGetFaceDataCallback

Removed