[英]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?我想阻止我的 Android 应用程序在我的个人资料中运行,当我的工作资料被激活时,有没有办法从我的 Android 应用程序中检查,Android 系统是否激活了工作资料? 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()看看https://developer.android.com/reference/android/os/UserManager#isManagedProfile()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.