Skip to content

Commit f961a57

Browse files
author
刘灵锋
committed
feat:Android升级到3.2.1版本
1 parent 29355a9 commit f961a57

File tree

5 files changed

+22
-11
lines changed

5 files changed

+22
-11
lines changed

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
## 平台支持(兼容性)
55
| Android|iOS|
66
| ---- | ----- |
7-
| 适用版本区间:4.4 - 11.0|适用版本区间:9 - 14|
7+
| 适用版本区间:4.4以上|适用版本区间:9 - 14|
88

99
## 环境准备
1010

@@ -115,21 +115,30 @@ class Demo extends Component {
115115

116116
## SDK 方法说明
117117

118-
### 1 开始活体检测验证
118+
### 1 初始化
119119

120120
#### 代码说明:
121121
```
122122
import {NativeModules} from 'react-native';
123123
const AliveHelper = NativeModules.AliveHelper;//对象创建
124-
AliveHelper.startAlive('businessId', timeout)
124+
AliveHelper.initWithBusinessID('businessId', timeout);
125125
```
126+
126127
#### 参数说明:
127128
* options基础参数:
128129

129-
|参数|类型|是否必填|默认值|描述|
130-
|----|----|--------|------|----|
131-
|businessId|String|||易盾分配的业务id|
132-
| timeout|Number|是|30秒|活体检测超时时间|
130+
|参数|类型|是否必填|默认值| 描述 |
131+
|----|----|--------|------------|----|
132+
|businessId|String||| 易盾分配的业务id |
133+
|timeout|Number||30秒| 活体检测超时时间/s |
134+
135+
### 2 开始活体检测验证
136+
137+
#### 代码说明:
138+
```
139+
AliveHelper.startAlive()
140+
```
141+
133142
### 2 停止活体检测
134143

135144
#### 代码说明:

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ repositories {
4646
dependencies {
4747
// implementation fileTree(dir: "libs", include: ["*.jar"])
4848
implementation 'com.facebook.react:react-native:+'
49-
api 'io.github.yidun:livedetect:3.0.6.2'
49+
api 'io.github.yidun:livedetect:3.2.1'
5050
api 'com.google.code.gson:gson:2.8.6'
5151
api('com.squareup.okhttp3:okhttp:3.12.12') {
5252
force = true

android/src/main/java/com/netease/alivedetected/AliveHelper.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@ public void init(ReactContext reactContext, String businessId, int timeOut) {
3737
if (cameraPreview != null) {
3838
AliveDetector.getInstance().init(reactContext, cameraPreview, businessId);
3939
AliveDetector.getInstance().setTimeOut(timeOut * 1000);
40+
} else {
41+
Log.i("AliveHelper", "cameraPreview为空");
4042
}
4143
}
4244

4345
public void startDetected() {
44-
AliveDetector.getInstance().startDetect();
4546
AliveDetector.getInstance().setDetectedListener(new DetectedListener() {
4647
@Override
4748
public void onReady(boolean b) {
@@ -109,6 +110,7 @@ public void onOverTime() {
109110
sendEvent("onResultChange", event);
110111
}
111112
});
113+
AliveDetector.getInstance().startDetect();
112114
}
113115

114116
public void stopDetected() {

android/src/main/java/com/netease/alivedetected/RNAliveViewModule.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public void startAlive() {
2929

3030
@ReactMethod
3131
public void stopAlive() {
32-
AliveDetector.getInstance().stopDetect();
32+
aliveHelper.stopDetected();
3333
}
3434

3535
@Override

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
{
33
"name": "@yidun/livedetect-plugin-rn",
4-
"version": "1.0.6",
4+
"version": "1.0.7",
55
"description": "yidun alive detect react-native plugin",
66
"main": "index.js",
77
"scripts": {

0 commit comments

Comments
 (0)