react-native-aaiios-liveness-sdk(v3.4.1)

Migration Guides

  1. From version 3.1.3, the methods onGiveUp and onLivenessViewRequestFailed have been removed, and the parameter errorCode of onDetectionFailed has been changed, please refer to the v3.1.3 change logs for details.

  2. From version 3.0.0, motion detection has been removed, so the properties and methods related to motion detection will not have any effect.

  3. From v2.0.1, we refactored the code and aligned most of the js api with the android side, so please refer to the table below when migrating from the old version to v2.0.1.

    old method namenew method name
    NativeModules.RNAAILivenessSDK.initWithMarket("your-market")AAIIOSLivenessSDK.initSDKByLicense("your-market", false)
    NativeModules.RNAAILivenessSDK.initWithMarketAndGlobalService("your-market", isGlobalService)AAIIOSLivenessSDK.initSDKByLicense("your-market", isGlobalService)
    NativeModules.RNAAILivenessSDK.init("your-access-key", "your-secret-key", "your-market")AAIIOSLivenessSDK.initSDKByKey("your-access-key", "your-secret-key", "your-market", false)
    NativeModules.RNAAILivenessSDK.configDetectOcclusion(true)AAIIOSLivenessSDK.setDetectOcclusion(true)
    NativeModules.RNAAILivenessSDK.configResultPictureSize(600)AAIIOSLivenessSDK.setResultPictureSize(600)
    NativeModules.RNAAILivenessSDK.configUserId("your-reference-id")AAIIOSLivenessSDK.bindUser("your-reference-id")
    NativeModules.RNAAILivenessSDK.configActionTimeoutSeconds(10)AAIIOSLivenessSDK.setActionTimeoutSeconds(10)

Download SDK

See this part to get SDK download link.

Running the example app

  1. Download SDK and extract it, then go into the example directory: cd example

  2. Install packages: yarn install

  3. Go into the ios subdirectory and install pod dependencies: cd ios && pod install

  4. Go into the example directory and start Metro: cd .. && yarn start

  5. Modify example/App.js to specify your market and license content(The license content is obtained by your server calling our openapi).

  6. run example app: react-native run-ios or open example.xcworkspace in Xcode and run.

Getting started

Getting started (react-native >= 0.60)

If your react-navive version >= 0.60, you can refer this part to intergrate react-native-aaiios-liveness-sdk.

  1. First rename the folder name react-native-aaiios-liveness-sdk-V{sdkversion} to react-native-aaiios-liveness-sdk, then we can try to integrate the SDK. There are two ways to integrate the SDK:

    • As local package:

      1. Put the react-native-aaiios-liveness-sdk folder to your react-native project.
      1. cd your react-native project root path and link this local sdk package. yarn add link:./react-native-aaiios-liveness-sdk
    • As remote package:

      1. Upload all files in react-native-aaiios-liveness-sdk folder to your private git repository, make sure the name of your repository is react-native-aaiios-liveness-sdk.
      2. Navigate to the root directory of your react-native project and install SDK. $ npm install git+ssh://git@{your-git-domain}:{your-git-user-name}/react-native-aaiios-liveness-sdk.git --save
  2. Add pod dependencies AAINetwork and AAILivenessUI to your Podfile:

  3. After integrate the SDK then we link SDK to iOS project.

    cd ios && pod install

  4. Then add camera and motion sensor (gyroscope) usage description in Info.plist as bellow. Ignore this step if you have added those.

Getting started (react-native < 0.60)

  1. Download the AAILivenessSDK and AAINetwork, then extract them and add AAILivenessSDK folder, AAINetwork.xcframework to your project:

  2. Add the RNLivenessPlugin folder to your project.

  3. In Xcode, choose "TARGETS -> General" add the following system libraries and frameworks in the Frameworks, Libraries, and Embedded Content section:

    • libz.tbd
    • libc++.tbd
    • libresolv.9.tbd
    • AVFoundation.framework
    • CoreMotion.framework
    • SystemConfiguration.framework
    • CoreTelephony.framework
    • Accelerate.framework
    • Metal.framework
    • MetalKit.framework
  1. Add -ObjC to the other linker flag in the project configuration.

  2. In Xcode, add camera and motion sensor (gyroscope) usage description in Info.plist as bellow. Ignore this step if you have added those.

  3. Rename index.js to AAIIOSLivenessSDK.js, then add this js file to your react native project.

Usage

Error code

The errorCode values of onDetectionFailed are as follows:

errorCoderaw native sdk codeDescription
PREPARE_TIMEOUTfail_reason_prepare_timeoutTimeout during the preparation stage
ACTION_TIMEOUTfail_reason_timeoutTimeout during the motion stage
MUTI_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
...(Other server side error codes)  

Change logs and release history

v3.4.1 Download

Update
  1. Sync native SDK.

v3.4.0 Download

Update
  1. Sync native SDK.
  2. Add configuration item hudBrandColor.

v3.3.0 Download

Update
  1. Sync native SDK.
New Features
  1. Added normalEllipseBorderCol3D configuration item, which is used to set the normal color of the ellipse border in 3D mode(near/distant mode). The default is #F5F5F5. If you want to maintain the previous interaction effect, you can call the following codes:

v3.1.3 Download

Breaking Changes
  1. Remove the callback methods onGiveUp and onLivenessViewRequestFailed, please use onDetectionFailed to handle the user's give up action and network request failed.
  2. The errorCode of onDetectionFailed has been changed, please refer to the Error code for details.
New Features
  1. Added additionalInfo parameter to onDetectionFailed method, which contains the following keys:

    • "eventId": This is used to help debug the specific cause of the error.
    • "rawErrorCode": The native sdk side raw error code.
    • "transactionId": This is used to help debug the specific cause of the server side error.
  2. Added additionalInfo parameter to onDetectionComplete method, which contains the following keys:

    • "eventId": This is used to help debug the specific cause of the error.
    • "transactionId": This is used to help debug the specific cause of the server side error.
    • "videoFilePath": The video file path, if you enable the video recording feature, otherwise this key will not exist.
  3. Added recordUserGiveUp configuration item, which is used to mark the action of tapping back button as "USER_GIVE_UP". The default is false. If you set true, the onDetectionFailed will be called when the user taps the top left back button while liveneness detection is running.

  4. Added method setAuditImageConfig and setVideoRecorderConfig to support collecting audit images and recording video during the detection process.

Update
  1. Sync native SDK to support PrivacyInfo.xcprivacy.

v3.1.2 Download

  1. Sync native SDK.

v3.1.1 Download

  1. Sync native SDK.

v3.1.0 Download

  1. Sync native SDK.

v3.0.7 Download

  1. Sync native SDK.
  2. Support "AAILivenessMarketBPS".

v3.0.5 Download

  1. Sync native SDK.
  2. Upgrade AAINetwork module to 1.0.2.

v3.0.4 Download

  1. Sync native SDK.
  2. Deprecate the prepareTimeoutInterval, please use timeoutDurationOf3DMode instead.

v3.0.3 Download

  1. Sync native SDK.

v3.0.2 Download

  1. Sync native SDK.

v3.0.0 Download

  1. Sync native SDK.
  2. From version 3.0.0, motion detection has been removed, so the properties and methods related to motion detection will not have any effect.

v2.0.7 Download

  1. Sync native SDK.

v2.0.6 Download

  1. Sync native SDK.

v2.0.5 Download

  1. Sync native SDK.

v2.0.4 Download

  1. Sync native SDK.
  2. Add configuration items playPromptAudio and showAnimationImgs.

v2.0.3 Download

  1. Sync native SDK.

v2.0.2 Download

  1. Sync native SDK.

v2.0.1 Download

  1. Refactored the code.

v1.3.4 Download

  1. Fix bugs.

v1.3.3 Download

  1. Optimizing the capture of face image.
  2. Support closed eye detection.
  3. Add localized string "pls_open_eye".
  4. Fix EXC_BAD_ACCESS bug that could occur in some cases.
  5. Fix the global service bug.
  6. Compressed images of AAIImgs.bundle.
  7. Removed 'android' folder.

v1.2.9.1 Download

  1. Fixed the bug that the audio could not be automatically switched with the language.

v1.2.9 Download

  1. Support setting language and prepareTimeoutInterval.

v1.2.8 Download

  1. Upgrade network module.

v1.2.1 Download

  1. Fix the bug that img of AAILivenessResult may be nil when the onDetectionComplete: method is called.

v1.2.0 Download

  1. Support to initialize SDK with license.

  2. Support face occlusion detection(only in the preparation phase, not in the action detection phase), this feature is off by default, you can turn it on if needed.

  3. Support Mexico,Malaysia,Pakistan,Nigeria,Colombia.