Prasath S
Prasath S

Reputation: 4380

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

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

Upvotes: 2

Views: 1276

Answers (1)

Thenuja
Thenuja

Reputation: 31

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

Upvotes: 3

Related Questions