提交 9ebd044d 编写于 作者: W wusongqing

updated docs

Signed-off-by: Nwusongqing <wusongqing@huawei.com>
上级 5f46a7ce
...@@ -106,31 +106,48 @@ ohos.permission.KEEP_BACKGROUND_RUNNING ...@@ -106,31 +106,48 @@ ohos.permission.KEEP_BACKGROUND_RUNNING
| function stopBackgroundRunning(context: Context, callback: AsyncCallback&lt;void&gt;): void;<br>function stopBackgroundRunning(context: Context): Promise&lt;void&gt;; | Cancels the continuous task.| | function stopBackgroundRunning(context: Context, callback: AsyncCallback&lt;void&gt;): void;<br>function stopBackgroundRunning(context: Context): Promise&lt;void&gt;; | Cancels the continuous task.|
For details about **WantAgent**, see [WantAgent](../reference/apis/js-apis-notification.md#WantAgent). For details about **wantAgent**, see [WantAgent](../reference/apis/js-apis-wantAgent.md).
**Table 4** Background modes **Table 4** Background modes
| Name| ID Value| Description|
| -------- | -------- | -------- | | Name| ID Value| Description| Item|
| DATA_TRANSFER | 1 | Data transfer.| | -------- | -------- | -------- | -------- |
| AUDIO_PLAYBACK | 2 | Audio playback.| | DATA_TRANSFER | 1 | Data transfer.| dataTransfer |
| AUDIO_RECORDING | 3 | Audio recording.| | AUDIO_PLAYBACK | 2 | Audio playback.| audioPlayback |
| LOCATION | 4 | Positioning and navigation.| | AUDIO_RECORDING | 3 | Audio recording.| audioRecording |
| BLUETOOTH_INTERACTION | 5 | Bluetooth-related task.| | LOCATION | 4 | Positioning and navigation.| location |
| MULTI_DEVICE_CONNECTION | 6 | Multi-device connection.| | BLUETOOTH_INTERACTION | 5 | Bluetooth-related task.| bluetoothInteraction |
| WIFI_INTERACTION | 7 | WLAN-related task (reserved).| | MULTI_DEVICE_CONNECTION | 6 | Multi-device connection.| multiDeviceConnection |
| VOIP | 8 | Voice and video call (reserved).| | WIFI_INTERACTION | 7 | WLAN-related task (reserved).| wifiInteraction |
| TASK_KEEPING | 9 | Computing task (for PC only).| | VOIP | 8 | Voice and video call (reserved).| voip |
| TASK_KEEPING | 9 | Computing task (for PC only).| taskKeeping |
## How to Develop ## How to Develop
1. Declare the continuous task permission in the **config.json** file. 1. Configure the continuous task permission and background mode type in the **config.json** file, with the ability type set to **service**.
```json ```json
"module": { "module": {
"package": "com.example.myapplication", "package": "com.example.myapplication",
...,
"abilities": [
{
"backgroundModes": [
"dataTransfer",
"location",
],
"type": "service"
}
],
"defPermissions": [
{
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING"
}
],
"reqPermissions": [ "reqPermissions": [
{ {
"name": "ohos.permission.KEEP_BACKGROUND_RUNNING" "name": "ohos.permission.KEEP_BACKGROUND_RUNNING"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册