Managed Configurations XML文件中defaultValue的用途是什么? [英] What is the purpose of the defaultValue in the Managed Configurations XML file?
问题描述
我将在正在开发的应用程序中使用托管配置.
I will be using Managed Configurations in an app I am developing.
在对此链接.
After getting some help with this answer, I do not understand how default values are used in Managed Configurations. My reference is this link.
在我的参考资料中,注释"下的Google说:"受管配置捆绑包对于受管配置提供程序明确设置的每个配置都包含一个项目.但是,您不能假定将存在一个配置只是因为您在托管配置XML文件中定义了默认值."
In my reference under "Note", Google says, "The managed configurations Bundle contains one item for every configuration that has been explicitly set by a managed configurations provider. However, you cannot assume that a configuration will be present in the bundle just because you defined a default value in the managed configurations XML file."
我了解,如果托管配置提供者未明确设置项目,则该项目将不在捆绑包中.但是下一条(最后一条)对我来说还不清楚.
I understand that if an item has not been explicitly set by a managed configurations provider, then that item will not be in the Bundle. But the next (last) line is not clear to me.
我的主要问题是托管配置XML文件中defaultValue的目的是什么?"?但我希望答案也能帮助回答或指导我回答以下问题:
My main question is "what is the purpose of the defaultValue in the managed configurations XML file"? But I'm hoping the answer will also help answer or guide me to answering these questions too:
- 谁可以读取defaultValue?
- 托管应用可以阅读吗?如果可以,怎么办?
- 托管配置提供程序可以读取它吗?如果可以,怎么办?
- 为什么我不能假设某个配置具有默认值,那么该配置将出现在捆绑软件中吗?托管配置提供程序是否负责读取defaultValue并随后对其进行显式设置?
推荐答案
如果管理应用程序未明确设置属性,则可以使用defaultValue
字段解释应用程序的行为.
You can use the defaultValue
field to explain how your app behaves if the property is not explicitly set by the managing app.
清单中引用的XML文件旨在供MDM使用,以在其控制台中显示UI,以便IT管理员可以配置您的应用程序.如果您为属性设置defaultValue
,则在首次配置您的应用时,MDM会预先填充相应的字段(例如,显示默认为true
的布尔属性的选中复选框).
The XML file referenced in the manifest is meant to be used by the MDM to display a UI in their console so the IT admin can configure your app. If you set a defaultValue
for a property the MDM pre-populates the corresponding field when your app is configured for the first time (e.g. display a checked checkbox for a boolean property that default to true
).
对于管理员,未配置您的应用程序应与使用默认配置对其进行配置相同.因此,为保持一致,无论属性是未设置还是设置为defaultValue
,您的应用程序都应具有相同的行为.
For the admin, not configuring your app should be the same as configuring it with the default configuration. Therefore, to be consistent, your app should behave the same way whether a property is unset or set to the defaultValue
.
要查看您的配置在MDM控制台中的外观,可以使用 Android管理体验演示.
To see how your configuration will look like in an MDM console you can use the Android Management Experience demo.
有关如何检索限制方案和defaultValue
的更多详细信息
More details on how the restriction schema and defaultValue
can be retrieved
可以检索XML文件中定义的应用程序的限制架构
The app's restriction schema defined in the XML file can be retrieved either
- 使用 Google Play EMM API getAppRestrictionsSchema a>方法,为每个限制返回
- 或使用 RestrictionManager.java ,并查看它如何在TestDPC的
defaultValue
- using the Google Play EMM API getAppRestrictionsSchema method which returns the
defaultValue
s for each restriction - or by any app on the device using RestrictionsManager.getManifestRestrictions, where the returned
RestrictionEntry
s have their values set to thedefaultValue
if specified in the XML file, or to a generic default value otherwise (0
forTYPE_INTEGER
,false
forTYPE_BOOLEAN
, etc). You can read the full logic of this method in AOSP's RestrictionManager.java, and see how it is used in TestDPC's ManageAppRestrictionsFragment.java.
这篇关于Managed Configurations XML文件中defaultValue的用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!