• Home
Name Date Size #Lines LOC

..--

AppScope/12-May-2024-3633

entry/12-May-2024-1,3971,248

screenshots/device/12-May-2024-

.gitignoreD12-May-202456 55

README.mdD12-May-20242.9 KiB4523

README_zh.mdD12-May-20242.8 KiB4423

build-profile.json5D12-May-20241 KiB4241

hvigorfile.jsD12-May-2024168 21

package.jsonD12-May-2024377 1918

README.md

1# Storage Space Statistics
2
3### Introduction
4
5This sample presents how to view the storage space usage, space of all installed applications, and available volumes of a device by using the application bundle management, application space statistics, and volume management modules.
6
7This sample uses the [<**DataPanel** component>](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md) to display the space information about different applications; uses [**Bundle**](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-Bundle.md) to obtain the application name and bundle information; uses [**App Space Statistics**](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-storage-statistics.md) to obtain the storage space usage of the device; use [**Volume Management**](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-volumemanager.md) to obtain information about available volumes of the device.
8Instructions:
9
101. The main page displays the detailed information about the storage space usage of the current device.
11
122. Tap **Application** to view the space of all installed applications.
13
143. Tap **View Available Volumes** to view information about all available volumes of the device.
15
16
17
18### Display Effect
19
20![](./screenshots/device/main_page_en.png)
21![](./screenshots/device/application_page_en.png)
22![](./screenshots/device/volume_page_en.png)
23
24### Required Permissions
25
26- Permission to obtain storage space information and available volumes: [ohos.permission.STORAGE_MANAGER](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/permission-list.md)
27
28- Permission to obtain information about installed applications: [ohos.permission.GET_BUNDLE_INFO_PRIVILEGED](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/permission-list.md)
29
30### Dependency
31
32N/A
33
34### Constraints
35
361. This sample can only be run on standard-system devices that use the Rockchip RK3568 development board.
37
382. This sample is based on the stage model, which is supported from API version 9 (SDK version: 3.2.7.5).
39
403. DevEco Studio 3.0 Release (Build Version: 3.0.0.993, built on September 4, 2022) must be used.
41
424. This sample uses the **@ohos.bundle.innerBundleManager**, **@ohos.volumeManager**, and **@ohos.storageStatistics** system APIs. To use the full SDK, obtain it from a mirror site and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](https://gitee.com/openharmony/docs/blob/master/en/application-dev/quick-start/full-sdk-switch-guide.md).
43
445. This example uses the **system_core** permissions (see [App Permission List](https://gitee.com/openharmony/docs/blob/master/en/application-dev/security/permission-list.md)). You need to [configure a high-level permission signature](https://docs.openharmony.cn/pages/v3.2Beta/zh-cn/application-dev/security/hapsigntool-overview.md).
45

README_zh.md

1# 存储空间统计
2
3### 介绍
4
5本示例通过应用程序包管理、应用空间统计与卷管理模块,实现了查看当前设备存储空间信息、所有安装的应用的存储信息、所有可用卷的存储信息的功能。
6
7本示例使用 [DataPanel组件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/tsbasiccomponents-datapanel.md) 展示不同种类的应用存储信息,通过 [Bundle模块](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-Bundle.md) 来获取不同应用的包名与应用名等信息, 使用 [应用空间统计](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-storage-statistics.md) 来查询当前设备的存储使用情况,使用 [卷管理](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-volumemanager.md) 来查询可用卷存储使用情况。
8使用说明:
9
101. 主页面会展示当前设备存储使用的详细信息。
11
122. 点击“应用”,可以查看当前安装的所有应用的存储使用情况。
13
143. 当有可用的卷时,点击“查看可用卷信息”查看当前设备所有的可用卷的存储使用情况。
15
16
17
18### 效果预览
19
20![](./screenshots/device/main_page_zh.png)
21![](./screenshots/device/application_page_zh.png)
22![](./screenshots/device/volume_page_zh.png)
23
24### 相关权限
25
261. 允许获取存储信息与可用卷信息:[ohos.permission.STORAGE_MANAGER](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md)
27
282. 允许获取已安装应用的信息:[ohos.permission.GET_BUNDLE_INFO_PRIVILEGED](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md)
29
30### 依赖
31
32不涉及。
33
34### 约束与限制
35
361. 本示例仅支持标准系统上运行,支持设备:RK3568。
37
382. 本示例为Stage模型,仅支持API9版本SDK,版本号:3.2.7.5。
39
403. 本示例需要使用DevEco Studio 3.0 Release (Build Version: 3.0.0.993, built on September 4, 2022)才可编译运行。
41
424. 本示例需要使用@ohos.bundle.innerBundleManager,@ohos.volumeManager,@ohos.storageStatistics系统权限的系统接口。使用Full SDK时需要手动从镜像站点获取,并在DevEcoStudio中替换,具体操作可参考 [替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md)43
445. 本示例使用了system_core级别的权限(相关权限级别请查看[权限定义列表](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/permission-list.md) ),需要手动配置高级别的权限签名(具体操作可查看[自动化签名方案](https://docs.openharmony.cn/pages/v3.2Beta/zh-cn/application-dev/security/hapsigntool-overview.md/) ) 。