简体   繁体   English

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

[英]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.

相关问题 如何以编程方式检查Android设备是否支持OTG功能 - How to check whether Android device supports OTG features programatically 以编程方式确定Android设备是否具有菜单按钮的方法? - way to programatically determine whether an Android device has a menu button? 如何使用异步任务以编程方式检查蓝牙是否已与其他设备连接? - How to check whether bluetooth has connected with other device programatically using Async Task? 如何检查 android 设备是否支持 gps? - How to check whether an android device has gps support or not? Android for work - 如何检查我的应用程序是否在工作配置文件中运行? - Android for work - How to check if my application is running in the work profile? 在Android上以编程方式通过Hands Free Profile连接到蓝牙设备 - Connect to bluetooth device via Hands Free Profile programatically on Android Chromecast SDK(Android) - 有没有办法检查播放设备上播放的媒体是否已播放完毕? - Chromecast SDK (Android) - is there a way to check whether the media playing on the cast device has finished playing? 如何检查Android设备GPS模块是否具有A-GPS支持 - How to check whether Android device GPS module has A-GPS support 如何检查Android设备是否具有在10.2或更高版本上运行的Google Play服务 - How to check the whether the android device has google play services running on 10.2 or greater 在android中2秒后检查设备是否处于漫游状态 - Check whether the device is in roaming or not after 2 seconds in android
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM