提交 248bbc5d 编写于 作者: W wangqing

文档修改

Signed-off-by: Nwangqing <wangqing136@huawei.com>
上级 4a1bdcd5
......@@ -106,7 +106,7 @@ ohos.permission.KEEP_BACKGROUND_RUNNING
| function stopBackgroundRunning(context: Context, callback: AsyncCallback&lt;void&gt;): void;<br/>function stopBackgroundRunning(context: Context): Promise&lt;void&gt;; | 停止后台长时任务的运行 |
其中,wantAgent的信息详见([WantAgent](../reference/apis/js-apis-notification.md#WantAgent接口)
其中,wantAgent的信息详见([WantAgent](../reference/apis/js-apis-wantAgent.md)
**表4** 后台模式类型
......@@ -125,21 +125,21 @@ ohos.permission.KEEP_BACKGROUND_RUNNING
## 开发步骤
1. 在config.json文件中配置长时任务权限和后台模式类型。其中ability类型为service
1. 在config.json文件中配置长时任务权限和后台模式类型,其中ability类型为service。
```json
"module": {
"package": "com.example.myapplication",
...
//...
"abilities": [
...
//...
{
"backgroundModes": [
"dataTransfer",
"location",
...
//...
],
...
//...
"type": "service"
}
],
......
......@@ -56,6 +56,7 @@ getRemainingDelayTime(requestId: number, callback: AsyncCallback&lt;number&gt;):
| callback | AsyncCallback&lt;number&gt; | 是 | 指定的callback回调方法。用于返回应用程序进入挂起状态之前的剩余时间,以毫秒为单位。 |
**示例**
```js
let id = 1;
backgroundTaskManager.getRemainingDelayTime(id, (err, res) => {
......@@ -127,12 +128,12 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。|
| wantAgent | [WantAgent](js-apis-notification.md#WantAgent接口) | 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动长时任务的结果。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。|
| wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 |
| callback | AsyncCallback&lt;void&gt; | 是 | callback形式返回启动长时任务的结果。 |
**示例**
```js
......@@ -178,13 +179,13 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
**系统能力:** SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 |
| wantAgent | [WantAgent](js-apis-notification.md#WantAgent接口) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| context | [Context](js-apis-Context.md) | 是 | 应用运行的上下文。 |
| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 |
| wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 |
**返回值**
| 类型 | 说明 |
| -------------- | ------------------------- |
......
......@@ -188,7 +188,7 @@ particleAbility.acquireDataAbilityHelper(uri)
startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback&lt;void&gt;): void;
向系统申请长时任务,使用callback形式返回结果。(此接口为api7接口,后续会被废弃,请使用新的[api8接口](js-apis-backgroundTaskManager.md)
向系统申请长时任务,使用callback形式返回结果。(此接口为api7接口,[建议使用新接口](js-apis-backgroundTaskManager.md#backgroundtaskmanager.startbackgroundrunning8)
**系统能力**:SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
......@@ -252,7 +252,7 @@ startBackgroundRunning(id: number, request: NotificationRequest): Promise&lt;voi
**系统能力**:SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
向系统申请长时任务,使用promise形式返回结果。(此接口为api7接口,后续会被废弃,请使用新的[api8接口](js-apis-backgroundTaskManager.md)
向系统申请长时任务,使用promise形式返回结果。(此接口为api7接口,[建议使用新接口](js-apis-backgroundTaskManager.md#backgroundtaskmanager.startbackgroundrunning8)
**参数:**
......@@ -313,7 +313,7 @@ wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
cancelBackgroundRunning(callback: AsyncCallback&lt;void&gt;): void;
向系统申请取消长时任务,使用callback形式返回结果。(此接口为api7接口,后续会被废弃,请使用新的[api8接口](js-apis-backgroundTaskManager.md)
向系统申请取消长时任务,使用callback形式返回结果。(此接口为api7接口,[建议使用新接口](js-apis-backgroundTaskManager.md#backgroundtaskmanager.stopbackgroundrunning8)
**系统能力**:SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
......@@ -344,7 +344,7 @@ particleAbility.cancelBackgroundRunning(callback);
cancelBackgroundRunning(): Promise&lt;void&gt;;
向系统申请取消长时任务,使用promise形式返回结果。(此接口为api7接口,后续会被废弃,请使用新的[api8接口](js-apis-backgroundTaskManager.md)
向系统申请取消长时任务,使用promise形式返回结果。(此接口为api7接口,[建议使用新接口](js-apis-backgroundTaskManager.md#backgroundtaskmanager.stopbackgroundrunning8)
**系统能力**:SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册