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

Android 检查设备上强制执行的设备管理策略,android,mdm,device-admin,Android,Mdm,Device Admin,我们是否可以检查设备管理员在设备上强制执行了哪些策略。我想启用/禁用某些功能,并根据设备上强制执行的策略向用户显示提示 例如:当相机启动时,我想在我的应用程序中禁用相机选项 设备上的管理员已启用限制策略。此 将有助于提高可用性 请注意,我的应用程序不是设备管理应用程序。所有应用程序都可以使用getter方法。因此,如果相机被禁用,应该告诉您。不过,只有适当的设备管理员才能更改相机禁用设置。所有应用程序都可以使用getter方法。因此,如果相机被禁用,应该告诉您。但是,只有适当的设备管理员才能更改

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

例如:当相机启动时,我想在我的应用程序中禁用相机选项 设备上的管理员已启用限制策略。此 将有助于提高可用性


请注意,我的应用程序不是设备管理应用程序。

所有应用程序都可以使用getter方法。因此,如果相机被禁用,应该告诉您。不过,只有适当的设备管理员才能更改相机禁用设置。

所有应用程序都可以使用getter方法。因此,如果相机被禁用,应该告诉您。但是,只有适当的设备管理员才能更改相机禁用设置。

发现有
UserManager
api可以帮助我做到这一点


发现有
UserManager
api可以帮助我做到这一点

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