未验证 提交 1ac50fd8 编写于 作者: O openharmony_ci 提交者: Gitee

!18217 telephony开发指南doc整改

Merge pull request !18217 from 高远/master
......@@ -3,8 +3,8 @@
## Scenario Description
You can implement the call service in either of the following ways:
- For a system application, use the **dial** API to make a voice or video call. The call will be displayed on the application page.
- For a third-party application, use the **makecall** API to start the system call application. Users can then make calls as needed.
- For a system application, use the **dialCall** API to make a voice or video call. The call will be displayed on the application page.
- For a third-party application, use the **makeCall** API to start the system call application. Users can then make calls as needed.
## Basic Concepts
......@@ -32,8 +32,8 @@ You can implement the call service in either of the following ways:
| Name | Description |
| ----------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| hasVoiceCapability(): boolean; | Checks whether the voice function is available. |
| dial(phoneNumber: string, callback: AsyncCallback<boolean>): void | Makes a call. This is a system API. |
| makeCall(phoneNumber: string, callback: AsyncCallback<void>): void | Redirects to the dial screen and displays the called number. |
| dialCall(phoneNumber: string, callback: AsyncCallback&lt;void&gt;): void | Makes a call. This is a system API. |
| makeCall(phoneNumber: string, callback: AsyncCallback&lt;void&gt;): void | Redirects to the dial screen and displays the called number. |
The **observer** module provides the functions of subscribing to and unsubscribing from the call service status. For details about the APIs, see [observer API Reference](../reference/apis/js-apis-observer.md).
......@@ -43,14 +43,14 @@ The **observer** module provides the functions of subscribing to and unsubscribi
## How to Develop
### Making a Call by Using the **dial** API (for System Applications Only)
### Making a Call by Using the **dialCall** API (for System Applications Only)
1. Declare the required permission: **ohos.permission.PLACE_CALL**.
This permission is of the **system\_basic** level. Before applying for the permission, ensure that the [basic principles for permission management](../security/accesstoken-overview.md#basic-principles-for-permission-management) are met. Then, declare the corresponding permission by following instructions in [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
2. Import the **call** and **observer** modules.
3. Invoke the **hasVoiceCapability** API to check whether the device supports the voice call function.
If the voice call function is supported, the user will be redirected to the dial screen and the dialed number is displayed.
4. Invoke the **dial** API to make a call.
4. Invoke the **dialCall** API to make a call.
5. (Optional) Register the observer for call status changes.
```js
// Import the required modules.
......@@ -64,9 +64,9 @@ This permission is of the **system\_basic** level. Before applying for the permi
return;
}
// If the device supports the voice call function, call the following API to make a call.
call.dial("13xxxx", (err, data) => {
this.output = this.output + `dial: ${JSON.stringify(data)}\n`
console.log(`callback: dial err->${JSON.stringify(err)} data->${JSON.stringify(data)}`)
call.dialCall("13xxxx", (err, data) => {
this.output = this.output + `dial call: ${JSON.stringify(data)}\n`
console.log(`callback: dial call err->${JSON.stringify(err)} data->${JSON.stringify(data)}`)
})
// (Optional) Register the observer for call service status changes.
......@@ -75,12 +75,12 @@ This permission is of the **system\_basic** level. Before applying for the permi
});
```
### Making a Call by Using the makecall API
### Making a Call by Using the makeCall API
1. Import the **call** and **observer** modules.
2. Invoke the **hasVoiceCapability** API to check whether the device supports the voice call function.
If the voice call function is supported, the user will be redirected to the dial screen and the dialed number is displayed.
3. Invoke the **makecall** API to start the system call application and make a call.
3. Invoke the **makeCall** API to start the system call application and make a call.
4. (Optional) Register the observer for call status changes.
```js
......
......@@ -3,8 +3,8 @@
## 场景介绍
开发者可以通过两种不同的方式实现拨打电话的功能:
- 对于系统应用,开发者可以使用dial接口,直接进行音频/视频呼叫,在应用界面显示对应的通话。
- 对于三方应用,开发者可以使用makecall接口,拉起系统电话应用,用户可以自行呼出通话。
- 对于系统应用,开发者可以使用dialCall接口,直接进行音频/视频呼叫,在应用界面显示对应的通话。
- 对于三方应用,开发者可以使用makeCall接口,拉起系统电话应用,用户可以自行呼出通话。
## 基本概念
......@@ -32,8 +32,8 @@
| 接口名 | 描述 |
| ----------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| hasVoiceCapability(): boolean; | 判断是否具有语音功能。 |
| dial(phoneNumber: string, callback: AsyncCallback<boolean>): void | 拨号。该接口为系统接口。 |
| makeCall(phoneNumber: string, callback: AsyncCallback<void>): void | 转到拨号屏幕,显示被叫号码。 |
| dialCall(phoneNumber: string, callback: AsyncCallback&lt;void&gt;): void | 拨号。该接口为系统接口。 |
| makeCall(phoneNumber: string, callback: AsyncCallback&lt;void&gt;): void | 转到拨号屏幕,显示被叫号码。 |
observer模块为开发者提供订阅和取消订阅通话业务状态的功能。具体API说明详见[接口文档](../reference/apis/js-apis-observer.md)
......@@ -43,15 +43,15 @@ observer模块为开发者提供订阅和取消订阅通话业务状态的功能
## 开发步骤
### 使用dial拨打电话(仅供系统应用使用)
### 使用dialCall拨打电话(仅供系统应用使用)
1. 声明接口调用所需要的权限:ohos.permission.PLACE_CALL
ohos.permission.PLACE_CALL权限级别为system_basic,在申请权限前,请保证符合[权限使用的基本原则](../security/accesstoken-overview.md#权限使用的基本原则)。然后参考[配置文件权限声明指导文档](../security/accesstoken-guidelines.md#配置文件权限声明)声明对应权限。
1. 声明接口调用所需要的权限:ohos.permission.PLACE_CALL
权限级别为system_basic,在申请权限前,请保证符合[权限使用的基本原则](../security/accesstoken-overview.md#权限使用的基本原则)。然后参考[配置文件权限声明指导文档](../security/accesstoken-guidelines.md#配置文件权限声明)声明对应权限。
2. 导入call和observer模块。
3. 调用hasVoiceCapability,确认当前设备是否支持拨号。
如果设备支持呼叫能力,则继续跳转到拨号界面,并显示拨号的号码。
4. 调用dial接口,拨打电话。
5.(可选)订阅通话业务状态变化。
4. 调用dialCall接口,拨打电话。
5. (可选)订阅通话业务状态变化。
```js
// import需要的模块
import call from '@ohos.telephony.call'
......@@ -64,9 +64,9 @@ ohos.permission.PLACE_CALL权限级别为system_basic,在申请权限前,请
return;
}
// 如果设备支持呼叫能力,调用以下接口进行拨号
call.dial("13xxxx", (err, data) => {
this.output = this.output + `dial: ${JSON.stringify(data)}\n`
console.log(`callback: dial err->${JSON.stringify(err)} data->${JSON.stringify(data)}`)
call.dialCall("13xxxx", (err, data) => {
this.output = this.output + `dial call: ${JSON.stringify(data)}\n`
console.log(`callback: dial call err->${JSON.stringify(err)} data->${JSON.stringify(data)}`)
})
// 订阅通话业务状态变化(可选)
......@@ -75,13 +75,13 @@ ohos.permission.PLACE_CALL权限级别为system_basic,在申请权限前,请
});
```
### 使用makecall拨打电话
### 使用makeCall拨打电话
1. 导入call和observer模块。
2. 调用hasVoiceCapability,确认当前设备是否支持拨号。
如果设备支持呼叫能力,则继续跳转到拨号界面,并显示拨号的号码。
3. 调用makecall接口,拉起系统电话应用,拨打电话。
4.(可选)订阅通话业务状态变化。
3. 调用makeCall接口,拉起系统电话应用,拨打电话。
4. (可选)订阅通话业务状态变化。
```js
// import需要的模块
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册