提交 dc2ff74b 编写于 作者: Z zhutianyi

Workscheduler新增参数更新文档

Signed-off-by: Nzhutianyi <zhutianyi2@huawei.com>
上级 a282e31f
......@@ -39,7 +39,14 @@ Instructs the **WorkSchedulerService** to add the specified task to the executio
isRepeat: false,
isPersisted: true,
bundleName: "com.example.myapplication",
abilityName: "MyExtension"
abilityName: "MyExtension",
parameters: {
mykey0: 2222,
mykey1: "ssssssssssssssssssssssssss",
mykey2: true,
mykey3: 1.5,
mykey4: 213749534591254587511
}
}
var res = workScheduler.startWork(workInfo);
console.info("workschedulerLog res:" + res);
......@@ -75,7 +82,14 @@ Instructs the **WorkSchedulerService** to stop the specified task.
isRepeat: false,
isPersisted: true,
bundleName: "com.example.myapplication",
abilityName: "MyExtension"
abilityName: "MyExtension",
parameters: {
mykey0: 2222,
mykey1: "ssssssssssssssssssssssssss",
mykey2: true,
mykey3: 1.5,
mykey4: 213749534591254587511
}
}
var res = workScheduler.stopWork(workInfo, false);
console.info("workschedulerLog res:" + res);
......@@ -272,7 +286,7 @@ Checks whether the last execution of the specified task timed out. This API uses
```
## WorkInfo
Provides detailed information about the task.
Provides detailed information about the task. The constraint of WorkInfo reference [Work Scheduler Overview](../../task-management/work-scheduler-overview.md)
**System capability**: SystemCapability.ResourceSchedule.WorkScheduler
......
......@@ -34,6 +34,8 @@ function isLastWorkTimeOut(workId: number): Promise<boolean>;| Checks whether th
**Table 2** WorkInfo parameters
> **Explanation:** The constraint of WorkInfo reference [Work Scheduler Overview](./work-scheduler-overview.md)
API|Description|Type
---------------------------------------------------------|-----------------------------------------|---------------------------------------------------------
workId | Work ID. Mandatory.|number
......@@ -48,6 +50,7 @@ storageRequest|Storage status.| StorageRequest
isRepeat|Whether the task is repeated.| boolean
repeatCycleTime |Repeat interval.| number
repeatCount |Number of repeat times.| number
parameters |Parameters carried| {[key: string]: any}
**Table 3** Work Scheduler callbacks
......@@ -85,7 +88,14 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
isRepeat: false,
isPersisted: true,
bundleName: "com.example.myapplication",
abilityName: "MyExtension"
abilityName: "MyExtension",
parameters: {
mykey0: 2222,
mykey1: "ssssssssssssssssssssssssss",
mykey2: true,
mykey3: 1.5,
mykey4: 213749534591254587511
}
}
var res = workScheduler.startWork(workInfo);
console.info("workschedulerLog res:" + res);
......@@ -103,7 +113,14 @@ function onWorkStop(work: WorkInfo): void; | Triggered when the Work Scheduler t
isRepeat: false,
isPersisted: true,
bundleName: "com.example.myapplication",
abilityName: "MyExtension"
abilityName: "MyExtension",
parameters: {
mykey0: 2222,
mykey1: "ssssssssssssssssssssssssss",
mykey2: true,
mykey3: 1.5,
mykey4: 213749534591254587511
}
}
var res = workScheduler.stopWork(workInfo, false);
console.info("workschedulerLog res:" + res);
......
......@@ -11,6 +11,17 @@ If your application needs to execute a non-real-time task, for example, data lea
The use of the Work Scheduler must comply with the following restrictions and rules:
- **Timeout**: The Work Scheduler callback can run only within the specified period of time. After the timeout, the callback automatically stops.
- **Execution frequency**:The system will perform hierarchical control on the work scheduler according to the bundle activity of the application, and limit the execution frequency of work scheduler.
Application group | Execution frequency constraint
--------------------|-------------------------
active group | minimum interval 2 hours
daily used group | minimum interval 4 hours
fixed group | minimum interval 24 hours
rare used group | minimum interval 48 hours
restricted group | forbidden
unused group | forbidden
- **WorkInfo setting**
(1) **workId**, **bundleName**, and **abilityName** are mandatory. **bundleName** must be set to the name of the current application. Otherwise, the verification will fail.
......@@ -18,3 +29,5 @@ The use of the Work Scheduler must comply with the following restrictions and ru
(2) At least one condition must be set.
(3) The repeat interval must be at least 20 minutes and must work with the Always repeat pattern or repeat times.
(4) Parameters support type include number, string and bool.
......@@ -313,7 +313,7 @@ isLastWorkTimeOut(workId: number): Promise\<boolean>
| isPersisted | boolean | 否 | 是否持久化保存工作 |
| isDeepIdle | boolean | 否 | 是否要求设备进入空闲状态 |
| idleWaitTime | number | 否 | 空闲等待时间 |
| parameters | {[key: string]: any} | 否 | 额外数据 |
| parameters | {[key: string]: any} | 否 | 携带参数信息 |
## NetworkType
触发工作的网络类型。
......
......@@ -50,7 +50,7 @@ storageRequest|存储状态| StorageRequest
isRepeat|是否循环任务| boolean
repeatCycleTime |循环间隔| number
repeatCount |循环次数| number
parameters |额外数据| {[key: string]: any}
parameters |携带参数信息| {[key: string]: any}
**表3** 延迟任务回调接口
......
......@@ -30,4 +30,4 @@
(3)重复任务时间间隔至少20分钟,当设置重复任务时间间隔时,必须设置始终重复和重复次数中的一个。
(4)额外数据支持number、string、bool三种类型。
\ No newline at end of file
(4)携带参数信息支持number、string、bool三种类型。
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册