繁体   English   中英

以编程方式检查我的 android 设备是否已激活工作资料?

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

我想阻止我的 Android 应用程序在我的个人资料中运行,当我的工作资料被激活时,有没有办法从我的 Android 应用程序中检查,Android 系统是否激活了工作资料? 谢谢

请找到以下代码:

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" );    
}

看看https://developer.android.com/reference/android/os/UserManager#isManagedProfile()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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