检查设备上强制执行的设备管理员策略

时间:2015-06-19 20:35:03

标签: android mdm device-admin

我们可以检查设备管理员在设备上强制执行哪些策略。我想启用/禁用某些功能,并根据设备上强制执行的策略向用户显示提示。

  

例如:我想在相机中禁用相机选项   限制策略已由设备上的管理员启用。这个   将有助于提高可用性。

请注意我的应用不是设备管理应用

2 个答案:

答案 0 :(得分:0)

getter方法on DevicePolicyManager可供所有应用AFAIK使用。因此,getCameraDisabled(null)应告诉您相机是否已禁用。但是,只有适当的设备管理员才能更改相机禁用设置。

答案 1 :(得分:0)

发现有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