I'm currently working on an app which is working with different profiles. To simplify the support process, I wan't to display currently active user within the app. According to this question: Get Currently Active User in Android this should be possible through:
ActivityManager.getCurrentUser()
Unfortunately the method is not available in Android O (SDK Version 27). The method is visible, but it's annotated by @hide which according to this answer: What does @hide mean in the Android source code? is not accessible. What other options do I have to the the currently active user?
Edit: What I'm talking about the current user detail. Assumption is you have two users on the same phone (i.e. private user + work profile user). To see my users, I can do the following:
> adb shell
> pm list users
> Users:
> UserInfo{0:Jeff:13} running
> UserInfo{10:Work profile:30} running
What I'm lookin for is the user id (0 or 10) in this example.