| 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<void>): 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. |
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.