Programatically Check whether my android device has activated work profile or not?

866 views Asked by At

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

1

There are 1 answers

0
Thenuja On

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()