What is the purpose of the defaultValue in the Managed Configurations XML file?
Asked Answered
A

1

2

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.

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.

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:

  • Who can read the defaultValue?
  • Can the managed app read it? If so, how?
  • Can the managed configurations provider read it? If so, how?
  • Why can't I assume that a configuration will be present in a bundle if it has a default value? Is the managed configurations provider responsible for reading the defaultValue and then explicitly setting it?
Alexandretta answered 19/7, 2017 at 23:48 Comment(0)
C
3

You can use the defaultValue field to explain how your app behaves if the property is not explicitly set by the managing app.

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).

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.

To see how your configuration will look like in an MDM console you can use the Android Management Experience demo.

Edit: More details on how the restriction schema and defaultValue can be retrieved

The app's restriction schema defined in the XML file can be retrieved either

Compression answered 20/7, 2017 at 0:28 Comment(4)
Thanks Fred. To clarify, is access to the defaultValue field only available when using the Google Play EMM API? Therefore, no Android APIs are available to retrieve it from the managed configurations XML file?Alexandretta
The restriction schema and defaultValue field can also be retrieved by any other app on the device. I edited my response with more details.Compression
Perfect! Understanding that the RestrictionEntry objects contain the defaultValue (if specified) as it's value along with all the other static properties from the managed configurations XML file was the missing piece for me. Thanks!Alexandretta
@Compression i guess the Android Management Expereicne has been discontinued :( what's the easiest way now to just test the descriptions from app_restrictions.xml and find out the character limit etc.Mongolism

© 2022 - 2024 — McMap. All rights reserved.