In Android Lollipop
, is it possible to retrieve the list of User
s in a device? I'm speaking of those selected by pressing the user's profile pic in the quicksetting drawer.
What other actions can we take on these users?
- Retrieve list of users?
- Retrieve user's profile pic?
- Change from one user to another?
- At least use an Intent to open the default usesr management page?
Lots of information can be found in the
UserManager
object. This class manages users and user details on a multi-user system.This class has a method
getUserProfiles
which returns a list ofUserHandles
for profiles associated with the user that the calling process is running on, including the user itself. AUserHandle
is a representation of a user on the device.Another useful class is
DevicePolicyManager
. To switch between users you can useswitchUser
inDevicePolicyManager
This is also described here, where the new Android 5.0 API's are explained.
To open the default user management page, you can use this
Intent
:I can't find official documentation for this action, but you can verify this in the source code. I have also tested this on Android 5.0.