デバイス(android 4.2+)で構成されたユーザーのリストを見つける方法はありますか?
ありがとう、ジェヤンティ
上手。ソースコードが表示されている場合UserManager.java
は、これらのメソッドを見つけることができます。Hovewerandroid.permission.MANAGE_USERS
は、これらのメソッドに必要です。
には署名|システムのMANAGE_USERS
保護レベルがあります。つまり、アプリケーションはプラットフォームキーで署名する必要があります。
/**
* Returns information for all users on this device.
* Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
* @return the list of users that were created.
* @hide
*/
public List<UserInfo> getUsers() {
try {
return mService.getUsers(false);
} catch (RemoteException re) {
Log.w(TAG, "Could not get user list", re);
return null;
}
}
/**
* Returns information for all users on this device.
* Requires {@link android.Manifest.permission#MANAGE_USERS} permission.
* @param excludeDying specify if the list should exclude users being removed.
* @return the list of users that were created.
* @hide
*/
public List<UserInfo> getUsers(boolean excludeDying) {
try {
return mService.getUsers(excludeDying);
} catch (RemoteException re) {
Log.w(TAG, "Could not get user list", re);
return null;
}
}