如何在可能没有托管配置提供程序的应用程序中使用托管配置? [英] How to use Managed Configurations in an app that may not have a Managed Configurations Provider?

查看:139
本文介绍了如何在可能没有托管配置提供程序的应用程序中使用托管配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款可在2种不同的Android环境(消费者和企业市场)中运行的应用.可以说这是一个短信应用程序,需要管理许多配置参数.

I am developing an app that will work in 2 different Android environments (consumer & corporate markets). Lets say it is a texting app with a dozen configuration parameters to manage.

第一个环境是没有启用Android Enterprise(AfW)功能的标准Android设备.因此,没有EMM(MDM)可以提供Android代理/客户端应用程序作为实现托管配置提供程序的设备/配置文件所有者.

The first environment is a standard Android device that has no Android Enterprise (AfW) features enabled. So there is no EMM (MDM) to supply an Android Agent/Client app to be a device/profile owner implementing a Managed Configurations Provider.

第二种环境在公司内部. EMM(MDM)用于管理其所有公司拥有的设备. EMM是设备所有者或配置文件所有者.它们被设置为使用托管配置,并且需要对此应用程序进行远程配置.

The second environment is within a corporation. An EMM (MDM) is used to manage all their corporate owned devices. The EMM is either a device or profile owner. They are set up to use Managed Configurations and require remote configuration of this app.

要同时支持这两种情况,此应用程序应如何检索配置?

To support both of these cases, how should this app retrieve configurations?

我当前的想法是检查我的应用程序实例是否属于设备或个人资料所有者.如果可以,我将使用托管配置.如果没有,它将允许使用SharedPreferences在设备上进行应用内配置.

My current thought is to check if the instance of my app belongs to a device or profile owner. If it does, I will use managed configurations. If it doesn't, it will allow on-device, within-the-app configuration using SharedPreferences.

我相信这会奏效,但似乎太像黑客了.它还限制了使用设备/配置文件所有者的公司不能向其用户提供控制权.我认为随着受管配置的采用率不断提高,其他Android应用程序肯定必须开始遇到这种情况.对于这种情况有更好的解决方案吗?

I believe this will work, but seems too much like a hack. It also restricts a company using a device/profile owner from giving their users control. I imagine other Android apps must be starting to encounter this situation with the adoption-rate of Managed Configurations increasing. Is there a better solution for this scenario?

推荐答案

您始终可以调用 RestrictionsManager.getApplicationRestrictions(),无论是否对设备进行管理:

You can always call RestrictionsManager.getApplicationRestrictions(), whether the device is managed or not:

  • 如果设备受管理且公司已配置了该应用程序,它将返回配置,
  • 如果设备不受管理或公司未配置应用程序,它将返回一个空的Bundle,您可以将控制权交给用户.
  • if the device is managed and the company has configured the app, it will return the configuration,
  • if the device is not managed or if the company has not configured the app, it will return an empty Bundle and you can give control to the user.

这篇关于如何在可能没有托管配置提供程序的应用程序中使用托管配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆