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

})

}

}

}

直接用就好啦

相关推荐
Miguo94well13 小时前
Flutter框架跨平台鸿蒙开发——地理知识速记APP的开发流程
flutter·华为·harmonyos·鸿蒙
IT陈图图14 小时前
Flutter × OpenHarmony 混合布局实战:在一个容器中优雅组合列表与网格
flutter·鸿蒙·openharmony
IT陈图图18 小时前
跨端一致的交互体验实践:基于 Flutter × OpenHarmony 的 AlertDialog 对话框示例解析
flutter·交互·鸿蒙·openharmony
ITUnicorn1 天前
Flutter x HarmonyOS 6:依托小艺开放平台创建智能体并在应用中调用
flutter·harmonyos·鸿蒙·智能体·harmonyos6
程序员清洒1 天前
Flutter for OpenHarmony:ListView — 高效滚动列表
开发语言·flutter·华为·鸿蒙
Miguo94well1 天前
Flutter框架跨平台鸿蒙开发——旅行攻略规划APP的开发流程
flutter·华为·harmonyos·鸿蒙
zilikew1 天前
Flutter框架跨平台鸿蒙开发——食物采购清单APP的开发流程
flutter·华为·harmonyos·鸿蒙
Miguo94well1 天前
Flutter框架跨平台鸿蒙开发——演讲稿生成器APP的开发流程
flutter·华为·harmonyos·鸿蒙
程序员清洒1 天前
Flutter for OpenHarmony:Dialog 与 BottomSheet — 弹出式交互
开发语言·flutter·华为·交互·鸿蒙
心态还需努力呀1 天前
【鸿蒙PC命令行适配】GNU Hello 库在鸿蒙 PC 上的交叉编译与移植部署实战
华为·鸿蒙·gnu·openharmony·开源鸿蒙