简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM