【问题标题】:Check device admin policies enforced on the device检查设备上强制执行的设备管理策略
【发布时间】:2015-09-05 22:49:28
【问题描述】:

我们能否检查设备管理员在设备上实施了哪些政策。我想启用/禁用某些功能,并根据设备上实施的政策向用户显示提示。

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

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

【问题讨论】:

    标签: android mdm device-admin


    【解决方案1】:

    getter 方法 on DevicePolicyManager 适用于所有应用程序,AFAIK。所以,getCameraDisabled(null) 应该会告诉你相机是否被禁用。不过,只有适当的设备管理员才能更改相机禁用设置。

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 2011-05-30
        • 1970-01-01
        • 2020-06-29
        • 2012-11-04
        • 1970-01-01
        • 2014-06-26
        • 1970-01-01
        • 2021-01-16
        • 1970-01-01
        相关资源
        最近更新 更多