harmony 鸿蒙@ohos.backgroundTaskManager (Background Task Management) (System API)

  • 2025-06-12
  • 浏览 (3)

@ohos.backgroundTaskManager (Background Task Management) (System API)

The BackgroundTaskManager module provides APIs to manage background tasks.

If a service needs to be continued when the application or service module is running in the background (not visible to users), the application or service module can request a transient task to delay the suspension or a continuous task to prevent the suspension.

If an application has a task that needs to be continued when the application is switched to the background and can be completed within a short period of time, the application can request a transient task. For example, if a user chooses to clear junk files in the Files application and exits the application, the application can request a transient task to complete the cleanup.

If an application has a service that can be intuitively perceived by users and needs to run in the background for a long period of time (for example, music playback in the background), the application can request a continuous task.

If a privileged system application needs to use certain system resources (for example, it wants to receive common events when suspended), it can request efficiency resources.

NOTE

Modules to Import

import backgroundTaskManager from '@ohos.backgroundTaskManager';  

BackgroundMode8+

System capability: SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask

Name Value Description
WIFI_INTERACTION 7 WLAN-related.
This is a system API.
VOIP 8 Audio and video calls.
This is a system API.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Background Tasks Kit

harmony 鸿蒙BackgroundProcessManager

harmony 鸿蒙TransientTask

harmony 鸿蒙TransientTask_DelaySuspendInfo

harmony 鸿蒙background_process_manager.h

harmony 鸿蒙DeviceUsageStatistics Error Codes

harmony 鸿蒙backgroundTaskManager Error Codes

harmony 鸿蒙reminderAgentManager Error Codes

harmony 鸿蒙workScheduler Error Codes

harmony 鸿蒙@ohos.WorkSchedulerExtensionAbility (Deferred Task Scheduling Callbacks)

0  赞