• Home
Name Date Size #Lines LOC

..--

AppScope/22-Oct-2025-3532

entry/22-Oct-2025-721655

hvigor/22-Oct-2025-3836

screenshots/22-Oct-2025-

.gitignoreD22-Oct-2025133 1212

README.mdD22-Oct-20253.9 KiB7151

build-profile.json5D22-Oct-20251.3 KiB5251

code-linter.json5D22-Oct-2025958 3534

hvigorfile.tsD22-Oct-2025843 225

oh-package.json5D22-Oct-2025834 2624

ohosTest.mdD22-Oct-20251.7 KiB119

README.md

1#  管理分布式账号(仅对系统应用开放)
2
3### 介绍
4
51.OEM厂商可以通过[分布式账号SDK](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-basic-services-kit/js-apis-distributed-account.md)将自有账号与本地系统账号建立关联关系。
6
72.实现对以下指南文档中 [管理分布式账号](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/basic-services/account/manage-distributed-account.md) 示例代码片段的工程化,保证指南中示例代码与sample工程文件同源。
8
9### 效果预览
10
11|                             首页                             |            执行Log in and bind distributed account on the current system account            |
12| :----------------------------------------------------------: | :----------------------------------------------------------: |
13| <img src="./screenshots/ManageDistributedAccount_1.png" width="360" style="zoom:33%;" /> | <img src="./screenshots/ManageDistributedAccount_2.png" width="360" style="zoom:33%;" /> |
14|          **执行Log out and unbind distributed account on the current system account**          |         **执行Log in and bind distributed account on the specified system account**         |
15| <img src="./screenshots/ManageDistributedAccount_3.png" width="360" style="zoom:33%;" /> | <img src="./screenshots/ManageDistributedAccount_4.png" width="360" style="zoom:33%;" /> |
16|          **执行Log out and unbind distributed account on the specified system account**          |                                                              |
17| <img src="./screenshots/ManageDistributedAccount_5.png" width="360" style="zoom:33%;" /> |                                                              |
18
19### 使用说明
20
211. 在主界面,点击'Log in and bind distributed account on the current system account',执行Log in and bind distributed account on the current system account。
222. 点击'Log out and unbind distributed account on the current system account',执行Log out and unbind distributed account on the current system account。
233. 点击'Log in and bind distributed account on the specified system account',执行Log in and bind distributed account on the specified system account。
244. 点击'Log out and unbind distributed account on the specified system account',执行Log out and unbind distributed account on the specified system account。
255. 执行结果会即时反馈在屏幕中央,并在控制台打印log。
26
27### 工程目录
28
29```
30entry/src/
31 ├── main
32 │   ├── ets
33 │   │   ├── entryability
34 │   │   ├── entrybackupability
35 │   │   └── pages
36 │   │       └── Index.ets               // 管理分布式账号示例代码
37 │   ├── module.json5
38 │   └── resources
39 ├── ohosTest
40 │   ├── ets
41 │   │   └── test
42 │   │       └── Ability.test.ets        // 自动化测试代码
43```
44
45### 相关权限
46
47[ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-system-apps.md#ohospermissionmanagedistributedaccounts)
48
49### 依赖
50
51不涉及。
52
53### 约束与限制
54
551.本示例仅支持标准系统上运行, 支持设备:RK3568。
56
572.本示例为Stage模型,支持API14版本full-SDK,版本号:5.0.2.57,镜像版本号:OpenHarmony_5.0.2.58。
58
593.本示例需要使用DevEco Studio 5.0.1 Release (Build Version: 5.0.5.306, built on December 6, 2024)及以上版本才可编译运行。
60
61### 下载
62
63如需单独下载本工程,执行如下命令:
64
65````
66git init
67git config core.sparsecheckout true
68echo code/DocsSample/Account/ManageDistributedAccount > .git/info/sparse-checkout
69git remote add origin https://gitee.com/openharmony/applications_app_samples.git
70git pull origin master
71````