I want to prevent my Android app is running in my personal profile, when my work profile is activated, is there any way to check from my Android app, Android System activated work profile or not? Thank you
Asked
Active
Viewed 539 times
1
-
https://stackoverflow.com/questions/40148837/how-to-distinguish-android-application-running-under-managed-profile-and-regular does this helps? – Dan Baruch May 23 '22 at 13:00
-
@DanBaruch I read the question and answer which you mentioned above. but my question is different, *How to check, whether my device has enabled the Work profile or not?* because we can check whether our device is running in the work profile or personal profile – FGH May 24 '22 at 05:58
1 Answers
2
Please find the below code:
final UserManager um = (UserManager) getSystemService(Context.USER_SERVICE);
if(um.isManagedProfile()){
Log.d(TAG,"It is work profile " );
}else{
Log.d(TAG,"It is a personal profile" );
}
have a look on https://developer.android.com/reference/android/os/UserManager#isManagedProfile()

Thenuja
- 21
- 3