@@ -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)
@@ -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.