HarmonyOS 人脸活体检测调用

HarmonyOS
2024-12-17 14:57:11
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
zbw_apple

H5调用应用侧方法可参考以下demo:

index.ets
Web()//注册方法
  .javaScriptProxy({
    object: this.testObj,
    name: "testObjName",
    methodList: ["getLocationTS"],
    controller: this.webController
  })

class testClass {
  constructor() {
  }

  async getLocationTS(): Promise<string> {
    //应用侧方法逻辑
  }
H5页面
<!DOCTYPE html>
<html>
<head>
    <link rel="stylesheet" type="text/css">
    <meta charset="UTF-8">
    <title>获取定位信息</title>
    <style>
        #prize {
            border-radius: 16px 16px 16px 16px;
            background-image: linear-gradient(180deg, #A2DAFF 0%, #EAF5FF 100%);
            margin-left: 1.82%;
            margin-top: 1.43%;
            width: 96.5%;
            height: 96.7%;
        }
    </style>
</head>
<body>
<div style="width:1000px;height:500px">
    <input style="width:1000px;height:100px;font-size:30px" id="inputText"/>
    <p style="width:1000px;height:100px;font-size:30px" id="demo">p1</p>
    <button style="width:1000px;height:100px" onclick="getLocation()">
        <span style="font-size:30px">获取定位</span>
    </button>
</div>

<script>
    function getLocation() {
<!--        ArtTS侧返回的如果是 promise对象,使用改方法处理 -->
<!--        具体可参考前端页面调用应用侧函数API,包含简单类型和复杂类型-->
<!--        https://developer.huawei.com/consumer/cn/doc/harmonyos-guides/web-in-page-app-function-invoking-0000001844832802-->
   <!-- H5侧方法调用 -->
        testObjName.getLocationTS()
        .then((param)=>{ document.getElementById("demo").innerHTML = "testObjName.getLocationTS()--"+JSON.stringify(param) })
        .catch((param)=>{ document.getElementById("demo").innerHTML = "testObjName.getLocationTS()--"+JSON.stringify(param) })
    }
</script>
</body>
</html>
}
分享
微博
QQ
微信
回复
2024-12-17 16:10:03
相关问题
HarmonyOS 人脸活体检测Vision Kit
462浏览 • 1回复 待解决
HarmonyOS 人脸活体检测问题
456浏览 • 1回复 待解决
HarmonyOS 是否有人脸活体检测API支持
244浏览 • 1回复 待解决
HarmonyOS 活体检测
389浏览 • 1回复 待解决
HarmonyOS 活体检测失败
438浏览 • 1回复 待解决
HarmonyOS 活体检测图片返回问题
186浏览 • 1回复 待解决
HarmonyOS自带的活体检测
428浏览 • 1回复 待解决
HarmonyOS 华为活体检测测试报告
700浏览 • 1回复 待解决
HarmonyOS 活体检测回调问题
589浏览 • 1回复 待解决
HarmonyOS 有没有活体检测的SDK?
533浏览 • 1回复 待解决
HarmonyOS 活体检测和卡证识别的demo
364浏览 • 1回复 待解决
HarmonyOS 人脸检测
402浏览 • 1回复 待解决
HarmonyOS人脸活体认证
532浏览 • 1回复 待解决