我们可以检查设备admin上的设备强制执行哪些策略。我希望启用/禁用某些功能并根据设备上强制执行的策略向用户显示提示。检查设备上执行的设备管理策略
对于例如:我想在我的应用停用相机选项时相机 限购政策已被管理员启用的device.This 将有助于提高可用性。
请注意我的应用程序是不是设备管理员应用程序。
我们可以检查设备admin上的设备强制执行哪些策略。我希望启用/禁用某些功能并根据设备上强制执行的策略向用户显示提示。检查设备上执行的设备管理策略
对于例如:我想在我的应用停用相机选项时相机 限购政策已被管理员启用的device.This 将有助于提高可用性。
请注意我的应用程序是不是设备管理员应用程序。
获取方法on DevicePolicyManager
适用于所有应用程序AFAIK。因此,getCameraDisabled(null)
应告诉您相机是否被禁用。不过,只有合适的设备管理员可以更改摄像头禁用的设置。
发现有UserManager
api这将帮助我做到这一点。 refer here
public boolean hasUserRestriction (String restrictionKey)
Added in API level 21
Returns whether the current user has been disallowed from performing certain actions or setting certain settings.
Parameters
restrictionKey The string key representing the restriction.
Returns
true if the current user has the given restriction, false otherwise.
[1]: http://developer.android.com/reference/android/os/UserManager.html#hasUserRestriction%28java.lang.String%29