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>
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
分享
微博
QQ
微信
回复
2024-12-17 16:10:03
相关问题
HarmonyOS 人脸活体检测问题
914浏览 • 1回复 待解决
HarmonyOS 人脸活体检测Vision Kit
993浏览 • 1回复 待解决
HarmonyOS 是否有人脸活体检测API支持
675浏览 • 1回复 待解决
HarmonyOS 活体检测
806浏览 • 1回复 待解决
HarmonyOS 活体检测失败
842浏览 • 1回复 待解决
HarmonyOS自带的活体检测
887浏览 • 1回复 待解决
HarmonyOS 活体检测图片返回问题
690浏览 • 1回复 待解决
HarmonyOS 活体检测回调问题
1013浏览 • 1回复 待解决
HarmonyOS 华为活体检测测试报告
1082浏览 • 1回复 待解决
HarmonyOS 有没有活体检测的SDK?
895浏览 • 1回复 待解决
HarmonyOS 活体检测和卡证识别的demo
835浏览 • 1回复 待解决
HarmonyOS人脸活体认证
922浏览 • 1回复 待解决
HarmonyOS 人脸检测
811浏览 • 1回复 待解决