HarmonyOS鸿蒙Next元服务里可以调起电话界面吗?

HarmonyOS鸿蒙Next元服务里可以调起电话界面吗? 元服务里可以调起电话界面吗?

3 回复

【解决方案】 元服务中可以支持跳转拨打电话

  • 跳转拨打电话,参考call.makeCall接口,代码样例如下:
import { BusinessError } from '@kit.BasicServicesKit';
// 获取context
let context = getContext(this) as Context;
// 从API15开始支持tel格式电话号码,如:"tel:13xxxx"
call.makeCall(context, "138xxxxxxxx").then(() => {
    console.log(`makeCall success`);
}).catch((err: BusinessError) => {
    console.error(`makeCall fail, promise: err->${JSON.stringify(err)}`);
});

更多关于HarmonyOS鸿蒙Next元服务里可以调起电话界面吗?的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


在HarmonyOS Next元服务中,可通过call接口调用电话界面。使用@ohos.telephony.call模块的makeCall方法,传入电话号码参数即可启动系统拨号界面。该功能需在module.json5中声明ohos.permission.PLACE_CALL权限。代码示例:call.makeCall("123456789")将调起拨号界面并显示指定号码。

是的,HarmonyOS Next的元服务支持通过系统能力调起电话界面。具体可通过@ohos.telephony系统接口中的makeCall方法实现,该方法会启动系统的拨号界面并自动填入指定号码。开发者需在module.json5中声明ohos.permission.PLACE_CALL权限,并在代码中动态申请。注意,实际拨号行为需用户手动确认,符合隐私保护要求。

回到顶部