HarmonyOS 人脸活体检测?

调用人脸活体检测控件。

interactiveLiveness.startLivenessDetection(routerOptions, (err: BusinessError, result: interactiveLiveness.InteractiveLivenessResult | undefined) => {
  if(err.code !== 0 && !result) {
    Logger.info("LivenessCollectionIndex", `Failed to detect. Code:${err.code},message:${err.message}`);
    return;
  }
  Logger.info('LivenessCollectionIndex', `Succeeded in detecting result:${result}`);
  toast("xxx")
})

活体检测成功以后,没有走回调方法,也就是拿不到result数据了,请问是怎么回事?

阅读 537
1 个回答
startLivenessDetection(config: InteractiveLivenessConfig, callback: AsyncCallback<InteractiveLivenessResult | undefined>): Promise<boolean>  

该方法检测成功能拿到回调信息的,回调函数,返回活体检测的结果。当前只适用于RouteRedirectionMode.BACK\_MODE跳转模式。并且只有在BETA3版本里才能用。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进