From 4.0.0, we've introduced significant API improvements and feature enhancements. To make upgrading easier, here’s what you need to know:
Previously, the module was used by importing the source code. Now, it has been changed to depend on the NPM repository, and we unified the Cordova plugin's public API. Please re-integrate by referring to the latest documentation. Available configuration options are now defined by the newest plugin version. If you need additional settings, contact us.
Add the dependency in package.json:
"dependencies": { "liveness-plugin-cordova": "^4.1.1"}For Android side, from 4.0.0 some APIs in the table below are now removed. You’ll need to update your code accordingly.
| Method/Property | Alternative | Notes |
|---|---|---|
| setActionSequence | - | No need to call. |
| setDetectionLevel | - | No need to call. |
| setVideoConfig | - | No need to call. |
| setAuditConfig | - | No need to call. |
| setDetectOcclusion | - | No need to call. |
| set3DLivenessTimeoutMills | - | No need to call. |
| setActionTimeoutMills | - | No need to call. |
| setResultPictureSize | - | No need to call. |
| bindUser | - | No need to call. |
| setSignatureId | - | No need to call. |
For iOS side,since we've unified the Cordova plugin's public API, all pre-4.0.0 Cordova public APIs are no longer supported. Please follow the latest plugin's public API as your reference.
The recommended alternative for the deprecated API is as follows:
xconst livenessParams = { cameraType: 'FRONT', detectOcclusion: false, // occlusion auditImageConfig: { enableCollectSwitch: true, // Whether to enable the audit image collection switch imageWidth: 400, // Image width imageQuality: 30, // Image quality relativeSecondsCaptureAfterCameraLaunched: 3.0, // Capture image at a relative number of seconds after the camera is launched }, livenessType: 'test_more', // Liveness detection type signatureId: '', // Signature ID, if available distantNearTimeout: 50000, // Timeout for distant-near detection in milliseconds silentTimeout: 50000, // Timeout for silent detection in milliseconds actionTimeout: 10000, // Timeout for actions in milliseconds prepareMillSeconds: 0, // Preparation time in milliseconds resultPictureSize: 600, // Result picture size maxRecordVideoSeconds: 600, // Maximum video recording time in seconds userId: '', // User ID maskColor: '#000000', // Mask color ovalColor: '#000000', // Oval color ovalNormalColor: '#000000', // Normal oval color};
startLivenessDetection(livenessParams, result => { console.log('Liveness detection result received:', result); setStatusMessage('Liveness detection finished.'); setLivenessResult(result); setIsLoading(false); });For detailed integration instructions, please refer to the integration documentation.