| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| AppScope/ | 22-Oct-2025 | - | 35 | 32 | ||
| entry/ | 22-Oct-2025 | - | 810 | 743 | ||
| hvigor/ | 22-Oct-2025 | - | 38 | 36 | ||
| screenshots/ | 22-Oct-2025 | - | ||||
| .gitignore | D | 22-Oct-2025 | 133 | 12 | 12 | |
| README.md | D | 22-Oct-2025 | 3.9 KiB | 77 | 56 | |
| build-profile.json5 | D | 22-Oct-2025 | 1.4 KiB | 58 | 57 | |
| code-linter.json5 | D | 22-Oct-2025 | 958 | 35 | 34 | |
| hvigorfile.ts | D | 22-Oct-2025 | 843 | 22 | 5 | |
| oh-package.json5 | D | 22-Oct-2025 | 834 | 26 | 24 | |
| ohosTest.md | D | 22-Oct-2025 | 1.7 KiB | 13 | 11 |
README.md
1# 管理应用账号 2 3### 介绍 4 51.应用开发者可以使用[应用账号SDK](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-basic-services-kit/js-apis-appAccount.md)管理本应用的账号数据。 6 7能力限制:应用卸载场景下,被卸载应用的账号数据会被删除;本地账号删除场景下,被删除本地账号下的所有应用的账号数据会被删除。 8 92.实现对以下指南文件中 [管理应用账号](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/basic-services/account/manage-application-account.md#/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-basic-services-kit/js-apis-appAccount.md) 示例代码片段的工程化。保证指南中示例代码与sample工程文件同源。 10 11### 效果预览 12 13| 首页 | **执行创建应用账号** | 14| :----------------------------------------------------------: | :----------------------------------------------------------: | 15| <img src="./screenshots/ManagerApplicationAccount_1.png" width="360" style="zoom:33%;" /> | <img src="./screenshots/ManagerApplicationAccount_2.png" width="360" style="zoom:33%;" /> | 16| **执行查询应用账号** | **执行存取账号的凭据** | 17| <img src="./screenshots/ManagerApplicationAccount_3.png" width="360" style="zoom:33%;" /> | <img src="./screenshots/ManagerApplicationAccount_4.png" width="360" style="zoom:33%;" /> | 18| **执行存取账号的自定义数据** | **执行存取账号的授权令牌** | 19| <img src="./screenshots/ManagerApplicationAccount_5.png" width="360" style="zoom:33%;" /> | <img src="./screenshots/ManagerApplicationAccount_6.png" width="360" style="zoom:33%;" /> | 20| **执行删除应用账号** | | 21| <img src="./screenshots/ManagerApplicationAccount_7.png" width="360" style="zoom:33%;" /> | | 22 23### 使用说明 24 251. 在主界面,可以点击’Create application account‘,创建应用账号。 262. 点击’Query application account‘,查询应用账号。 273. 点击’Access account credentials‘,存取账号的凭据。 284. 点击’Access custom data of the account‘,存取账号的自定义数据。 295. 点击’Access account authorization token‘,存取账号的授权令牌。 306. 点击’Delete application account‘,删除应用账号。 317. 执行结果会即时反馈在屏幕中央,并在控制台打印log。 32 33### 工程目录 34 35``` 36entry/src/ 37 ├── main 38 │ ├── ets 39 │ │ ├── entryability 40 │ │ ├── entrybackupability 41 │ │ └── pages 42 │ │ └── Index.ets // 管理应用账号示例代码 43 │ ├── module.json5 44 │ └── resources 45 └── ohosTest 46 └── ets 47 └── test 48 └── Ability.test.ets // 自动化测试代码 49``` 50 51### 相关权限 52 53不涉及。 54 55### 依赖 56 57不涉及。 58 59### 约束与限制 60 611.本示例仅支持标准系统上运行, 支持设备:RK3568。 62 632.本示例为Stage模型,支持API14版本full-SDK,版本号:5.0.2.57,镜像版本号:OpenHarmony_5.0.2.58。 64 653.本示例需要使用DevEco Studio 5.0.1 Release (Build Version: 5.0.5.306, built on December 6, 2024)及以上版本才可编译运行。 66 67### 下载 68 69如需单独下载本工程,执行如下命令: 70 71```` 72git init 73git config core.sparsecheckout true 74echo code/DocsSample/Account/ApplicationAccount > .git/info/sparse-checkout 75git remote add origin https://gitee.com/openharmony/applications_app_samples.git 76git pull origin master 77````