鸿蒙 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;

})

}

}

}

直接用就好啦

相关推荐
梦想不只是梦与想5 小时前
鸿蒙 消息推送:Push Token的获取(四)
harmonyos·鸿蒙·推送
不羁的木木7 小时前
HarmonyOS AI开发提效工具:DevEco Code & DevEco CLI - 跨设备调试与AI应用部署
人工智能·华为·harmonyos·鸿蒙
不羁的木木9 小时前
HarmonyOS AI开发提效工具:DevEco Code & DevEco CLI - AOT编译加速AI应用启动
harmonyos·鸿蒙
浮芷.12 小时前
鸿蒙 6.1 新特性-60fps流畅人物跳跃功能算法深度解析-鸿蒙PC端正弦值计算法
算法·华为·harmonyos·鸿蒙·鸿蒙系统
YM52e1 天前
鸿蒙PC ArkTS 声明合并问题深度解析与最佳实践
学习·华为·harmonyos·鸿蒙·鸿蒙系统
浮芷.1 天前
鸿蒙HarmonyOS 6.1新特性之沉浸式光感效果实现过程中的各类问题解决-鸿蒙PC版(一)
华为·harmonyos·鸿蒙·鸿蒙系统
轻口味1 天前
轻规划鸿蒙开发实战7:接管 Ability Kit 跨设备流转,EntryAbility 全链路 onContinue 数据打包与无缝接
华为·harmonyos·鸿蒙
浮芷.1 天前
HarmonyOS 6.1 沉浸式光感效果-样式切换效果问题解决方案-鸿蒙PC方向
华为·harmonyos·鸿蒙
xcLeigh1 天前
鸿蒙PC平台 imv 图片查看器适配实战:极简主义设计的 Electron 迁移
华为·electron·harmonyos·鸿蒙·imv·图片操作·web_engine
YM52e1 天前
手写模型集合书籍鸿蒙PC ArkTS 对象字面量类型问题约束深度解析
学习·华为·harmonyos·鸿蒙