• Home
Name Date Size #Lines LOC

..--

AppScope/06-May-2025-3633

entry/06-May-2025-851717

hvigor/06-May-2025-2422

screenshots/device/06-May-2025-

.gitignoreD06-May-2025142 1111

README.mdD06-May-2025437 168

README_zh.mdD06-May-20252.7 KiB6745

build-profile.json5D06-May-20251 KiB4341

hvigorfile.tsD06-May-2025158 21

hvigorwD06-May-20252.1 KiB6228

hvigorw.batD06-May-20252 KiB7356

oh-package.json5D06-May-2025810 2725

ohosTest.mdD06-May-2025540 137

README.md

1# Call
2
3### Introduction
4
5This sample shows how to make a call and view the call information.
6
7### Usage
8
91. Enter a phone number and tap **Call** to make a call.
10
112. Check the call information, including whether the call is successful, whether a call is ongoing, the call status, whether the called number is an emergency number, and the formatted phone number.
12
13### Constraints
14
15This sample can only be run on standard-system devices.
16

README_zh.md

1# 拨打电话
2
3### 介绍
4
5本示例使用[call](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-telephony-kit/js-apis-call-sys.md)相关接口实现了拨打电话并显示电话相关信息的功能
6
7### 效果预览
8
9|主页|
10|--------------------------------|
11|![image](screenshots/device/call.png)|
12
13使用说明
14
151.输入电话号码后,点击**电话**按钮,进行拨打电话。
16
172.拨打电话后文本框会显示拨打是否成功,是否存在通话,通话状态,是否紧急号码,格式化后的电话号码。
18
19### 工程目录
20```
21entry/src/main/ets/
22|---common
23|   |---CallView.ets                   // 电话API
24|---entryability
25|   |---EntryAbility.ts
26|---model
27|   |---Logger.ts                      // 日志工具
28|---pages
29|   |---Index.ets                      // 首页
30```
31### 具体实现
32
33* 该示例展示拨打电话功能,dial方法拨打电话,可设置通话参数,hasCall方法判断是否存在通话,getCallState方法获取当前通话状态,isEmergencyPhoneNumber方法判断是否是紧急电话号码,formatPhoneNumber方法格式化电话号码,formatPhoneNumberToE164方法将电话号码格式化为E.164表示形式。
34* 源码链接:[CallView.ets](entry/src/main/ets/common/CallView.ets)
35* 接口参考:[@ohos.telephony.call](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-telephony-kit/js-apis-call-sys.md)
36
37### 相关权限
38
39拨打电话权限: [ohos.permission.PLACE_CALL](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionplace_call)
40
41### 依赖
42
43不涉及。
44
45### 约束与限制
46
471.本示例仅支持在标准系统上运行。
48
492.本示例需要插入SIM卡,目前该功能仅支持部分机型。
50
513.本示例已适配API version 9版本SDK,版本号:3.2.11.9。
52
534.本示例需要使用DevEco Studio 3.1 Beta2 (Build Version: 3.1.0.400, built on April 7, 2023)及以上版本才可编译运行。
54
555.本示例所配置的权限ohos.permission.PLACE_CALL为system_basic级别(相关权限级别可通过[权限定义列表](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md)查看),需要手动配置对应级别的权限签名(具体操作可查看[自动化签名方案](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/hapsigntool-guidelines.md))56
57### 下载
58
59如需单独下载本工程,执行如下命令:
60```
61git init
62git config core.sparsecheckout true
63echo code/SystemFeature/Telephony/Call/ > .git/info/sparse-checkout
64git remote add origin https://gitee.com/openharmony/applications_app_samples.git
65git pull origin master
66
67```