harmony(鸿蒙)Work Scheduler Overview

2022-08-09 浏览 (787)

Work Scheduler Overview

The Work Scheduler provides a mechanism for applications to execute non-real-time tasks when the system is idle. If the preset conditions are met, the tasks will be placed in the execution queue and scheduled when the system is idle.

Usage

If your application needs to execute a non-real-time task, for example, data learning, you can harness the Work Scheduler mechanism, which will schedule the task based on the storage space, power consumption, temperature, and more when the preset conditions are met.

Constraints

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 controls the execution frequency of Work Scheduler tasks based on the activity level of their respective applications.

    Application GroupWork Scheduler Task Execution Frequency
    ActiveAt a minimum interval of 2 hours
    Used every dayAt a minimum interval of 4 hours
    Frequently usedAt a minimum interval of 24 hours
    Infrequently usedAt a minimum interval of 48 hours
    RestrictedProhibited
    UnusedProhibited
  • WorkInfo setting

    • workId, bundleName, and abilityName are mandatory. bundleName must be set to the name of the current application. Otherwise, the verification will fail.

    • At least one condition must be set.

    • The repeat interval must be at least 20 minutes and must work with the Always repeat pattern or repeat times.

    • The carried parameters can be of the number, string, or bool type.

你可能感兴趣的鸿蒙文章

harmony(鸿蒙)Task Management

harmony(鸿蒙)Background Task Management Development

harmony(鸿蒙)Background Task Management Overview

harmony(鸿蒙)Work Scheduler Development

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/95dfabc3d39d4e348bcbd278adc6717d