【发布时间】:2016-05-28 04:17:34
【问题描述】:
我们可以在Android设备上创建多个用户和配置文件,例如,有一个主用户,我还设置了一个名为“工作配置文件”的工作配置文件。
使用以下 adb 命令:
adb shell pm list users
我得到了这个结果:
UserInfo{0:My User:13} 正在运行 UserInfo{10:Work Profile:30} 正在运行
很好,我可以看到我的用户信息,上面有名称工作资料。 现在,我想从我的应用程序中获取此列表。
我尝试使用此代码:
for(Account account: AccountManager.get(this).getAccounts()) {
DebugLog.e("COUCOU " + account.name + " " + account.toString());
}
但工作资料帐户未显示在列表中。只有主要用户... 知道如何获得与 ADB shell 命令相同的列表吗??
【问题讨论】:
-
没人?这将非常有用。
标签: android user-profile profile-owner