Is it possible to somehow get access to smartphone users (or create a new one)?

1 answer 1

You can use UserManager (available with API 17) to get data about device users (not to be confused with accounts on the device).

UserManager um = (UserManager) context.getSystemService(USER_SERVICE); List<UserHandle> userHandles = um.getUserProfiles(); //метод доступен с API 21 

You may need permission to work with this class.

 <uses-permission android:name="android.permission.MANAGE_USERS"/> 

Which, unfortunately, is only available for system applications.

  • That is, to create a new user will not work? - kapmayn
  • 3
    @kapmayn, I think it is not half. And this, in general, is not strange. I would not really want any application to manage users on my device. - Vladyslav Matviienko
  • one
    in fact, it is possible, for this you need an AccountAuthenticator account, AUTHENTICATE_ACCOUNTS permission, the manager himself where to add, and also permission for his work. - Shwarz Andrei