如何使用 MDM 在 Android 应用程序中获取托管配置数据

How to get managed configuration data in Android App using MDM

我有一个 Android 应用程序,我希望在设备打开时预先填充 UserNameserverURL,它将根据设备注册获取这些值在 userNameserverURL 字段上。

我可以使用 Android 限制 API 来获取那些配置值吗? 像下面

List<RestrictionEntry> restrictions =
                manager.getManifestRestrictions(Constants.PACKAGE_NAME_APP_RESTRICTION_SCHEMA);

Android

的文件似乎有点流行

Android 文档并不完美,但至少这个关于 managed configurations 的文档有点好 ;) .

To provide externally managed configurations:

  • Declare the managed configurations in your app manifest. Doing so allows the IT admin to read the app's configurations through Google Play APIs.
  • Whenever the app resumes, use the RestrictionsManager object to check the current managed configurations, and change your app's UI and behavior to conform with those configurations.
  • Listen for the ACTION_APPLICATION_RESTRICTIONS_CHANGED intent. When you receive this broadcast, check the RestrictionsManager to see what the current managed configurations are, and make any necessary changes to your app's behavior.

您还可以查看示例项目 AppRestrictions 了解更多详情。

祝你好运