• Home
Name Date Size #Lines LOC

..--

entry/12-May-2024-751663

screenshots/device/12-May-2024-

.gitignoreD12-May-2024121 88

README.mdD12-May-20241.2 KiB2715

README_zh.mdD12-May-20241.1 KiB2915

build-profile.json5D12-May-20241 KiB4341

hvigorfile.jsD12-May-2024174 21

package.jsonD12-May-2024409 2019

README.md

1# Background Task Management
2
3### Introduction
4
5This sample shows how a download task can be performed at the background even if the app exits. The display effect is as follows:
6
7![](./screenshots/device/backgroundtaskmanager_en.png)
8
9### Concepts
10
11If 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.
12
13### Required Permissions
14
15ohos.permission.KEEP_BACKGROUND_RUNNING
16
17### Usage
18
191. Touch the **Download** button and exit the app. The download task is pushed to the background for execution. When a task starts to be executed in the background, a notification and the download progress will be displayed.
20
21### Constraints
22
23- This sample can only be run on standard-system devices.
24- You need to refresh the notification window to view the download progress. In addition, the download ends when the download progress reaches 20% in this sample.
25- This feature is supported form API version 9.
26
27- This sample requires DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022) to compile and run.

README_zh.md

1# 后台任务管理
2
3### 简介
4
5本示例模拟下载功能,将下载任务通过后台任务管理进行处理,实现退出应用后任务仍能够执行,直至任务结束。实现效果如下:
6
7![](./screenshots/device/backgroundtaskmanager.png)
8
9### 相关概念
10
11当应用或业务模块处于后台(无可见界面)时,如果有需要继续执行或者后续执行的业务,可基于业务类型,申请短时任务延迟挂起(Suspend)或者长时任务避免进入挂起状态。
12
13### 相关权限
14
15后台任务管理权限:ohos.permission.KEEP_BACKGROUND_RUNNING
16
17### 使用说明
18
191.点击**下载**按钮,退出应用,将下载任务推送到后台执行。当任务在后台开始执行时会有通知提醒,且有下载任务进度显示。
20
21### 约束与限制
22
231.本示例仅支持在标准系统上运行。
24
252.查看下载进度时需要刷新通知窗口,且下载进度到20%结束。
26
273.从API version 9开始支持。
28
294.本示例需要使用DevEco Studio 3.0 Beta4 (Build Version: 3.0.0.992, built on July 14, 2022)才可编译运行。