鸿蒙 H5 拉起手机拨号

// xxx.ets

import { webview } from '@kit.ArkWeb';

import { call } from '@kit.TelephonyKit';

@Entry

@Component

struct WebComponent {

webviewController: webview.WebviewController = new webview.WebviewController();

build() {

Column() {

Web({ src: $rawfile('call.html'), controller: this.webviewController })

.onLoadIntercept((event) => {

if (event) {

let url: string = event.data.getRequestUrl();

// 判断链接是否为拨号链接

if (url.indexOf('tel://') === 0) {

// 跳转拨号界面

call.makeCall(url.substring(6), (err) => {

if (!err) {

console.info('make call succeeded.');

} else {

console.info('make call fail, err is:' + JSON.stringify(err));

}

});

return true;

}

}

return false;

})

}

}

}

直接用就好啦

相关推荐
xd1855785556 小时前
电影匹配引擎-基于鸿蒙的心情电影推荐应用开发实践
人工智能·安全·华为·harmonyos·鸿蒙
千逐687 小时前
HarmonyOS 实战 | @State 不神秘——变量一变界面就跟着变
华为·harmonyos·鸿蒙
xd18557855510 小时前
梦境解析师-基于鸿蒙的梦境心理分析应用开发实践
人工智能·华为·harmonyos·鸿蒙
千逐6811 小时前
鸿蒙实战:一多自适应与原子化布局 —— 一次开发多端部署的工程化落地
华为·harmonyos·鸿蒙
ZZZMMM.zip13 小时前
基于鸿蒙PC与鸿蒙Flutter框架构建AI本地生活服务平台
人工智能·flutter·华为·harmonyos·鸿蒙
星释1 天前
鸿蒙智能体开发实战:23.常见问题
服务器·华为·ai·harmonyos·鸿蒙·智能体
星释1 天前
鸿蒙智能体开发实战:39.鸿蒙壁纸大师 - 前端卡片显示与交互优化
前端·华为·交互·harmonyos·鸿蒙·火山引擎
●VON1 天前
HarmonyKit | 鸿蒙开发展望:HarmonyKit 未来路线图与社区共建
华为·单元测试·harmonyos·鸿蒙
绝世番茄1 天前
Column 与 if/else 条件渲染:动态子组件的布局行为
华为·harmonyos·鸿蒙
千逐681 天前
鸿蒙实战:自由流转与跨设备迁移——基于 ContinueAbility 与应用接续的完整落地指南
华为·harmonyos·鸿蒙