Luc*_*eto 5 android android-sensors device-admin device-owner android-enterprise
我正在开发一个跟踪应用程序,并且需要防止用户关闭用于确定位置的基本传感器。我无法修改设备ROM或具有root用户访问权限(或者至少希望没有该用户访问权限),但是我想到了使用设备管理API通过概要文件所有者或设备所有者模式执行这些功能。我基本上是在寻找一种方法来阻止Android设置中的这些功能。
我不确定这是否可行以及如何实现,我没有在GitHub中找到实现此功能的应用程序示例。谁能给我一个简单的例子或特定的文档?
我试图遵循这三个文档,但没有成功找到针对此特定功能的解决方案:
https://source.android.com/devices/tech/admin https://developer.android.com/guide/topics/admin/device-admin https://developers.google.com/android/management/introduction
这是我一直在尝试的摘录:
setUserRestriction(UserManager.DISALLOW_CONFIG_WIFI, true);
setUserRestriction(UserManager.DISALLOW_CONFIG_MOBILE_NETWORKS, active);
setUserRestriction(UserManager.DISALLOW_CONFIG_BLUETOOTH, active);
private void setUserRestriction(String restriction, boolean disallow){
if (disallow) {
mDevicePolicyManager.addUserRestriction(mAdminComponentName, restriction);
} else {
mDevicePolicyManager.clearUserRestriction(mAdminComponentName,
restriction);
}
}
Run Code Online (Sandbox Code Playgroud)
DISALLOW_CONFIG_BLUETOOTH已在API级别18公共静态最终字符串DISALLOW_CONFIG_BLUETOOTH中添加
指定是否禁止用户配置蓝牙。这并不限制用户打开或关闭蓝牙。默认值为false。
此限制不会阻止用户使用蓝牙。要完全禁止在设备上使用蓝牙,请使用DISALLOW_BLUETOOTH。
此限制对托管配置文件无效。
用户限制的关键。
类型:布尔
归档时间: |
|
查看次数: |
269 次 |
最近记录: |