接入示例

最近更新时间:2024-07-03 18:06:31

我的收藏
权威库网纹图片比对、自带对比源对比接入示例:
# 在DemoPage中单击某个按钮的代码逻辑:
//先填好数据
let inputData = new InputData(
orderNo,
this.appId,
'1.0.0',
this.nonce,
this.userId,
sign,
this.licence,
faceId
)
//设置必需参数
let wbFaceVerifyConfig = new WbFaceVerifyConfig(inputData);
//是否打开 sdk 日志开关
wbFaceVerifyConfig.isEnableLog = true;

WbCloudFaceVerifySdk.getInstance().initSdk(getContext(), wbFaceVerifyConfig, {
onLoginSuccess: () => {
DemoLog.i(this.TAG, `onLoginSuccess:`)
WbCloudFaceVerifySdk.getInstance().startWbFaceVerifySdk(getContext(), {
onFinish: (_result: WbFaceVerifyResult) => {
DemoLog.i(this.TAG, `WbCloudFaceVerifySdk onFinish`)
//todo 处理刷脸结果
……
//处理完后释放 sdk
//【特别注意】请在拿到 sdk 结果后对 sdk 进行释放,不要在页面结束时释放,避免未能获取刷脸回调结果的情况
WbCloudFaceVerifySdk.getInstance().release();
}
})
},
onLoginFail: (error: WbFaceError) => {
DemoLog.e(this.TAG, `onLoginFailed:JSON.stringify(error)`)
//todo 处理登录错误逻辑
……
//【特别注意】请在拿到 sdk 结果后对 sdk 进行释放,不要在页面结束时释放,避免未能获取刷脸回调结果的情况
WbCloudFaceVerifySdk.getInstance().release();
}
})