Search code examples
androidandroid-studioandroid-management-api

Android Studio default XML bool value not being used for managed configuration setting


this is a simple question: I use the Android Mgmt. API for fully managed devices (Android tablets) in the field. Through that, I have numerous managed configuration settings defined in the code. There are some booleans which all default to false EXCEPT one:

<restriction
    android:key="autoLaunch"
    android:title="@string/auto_launch_title"
    android:defaultValue="@bool/auto_launch_default"
    android:restrictionType="bool" /> 

I'm pretty certain this was working properly when I set it up a year or so ago. Recently, however, I was creating a policy in an MDM I have built, which queries for a Google Managed Config iframe that displays all of the settings. The field for autoLaunch is defaulting to false.

The bool default value, @bool/auto_launch_default, is defined in res/values/bools.xml:

<bool name="auto_launch_default">true</bool>

I would like to keep using this format if possible. I'm really just wondering why this is not working anymore, if anyone has any input on this. I do recall that the format of my managed config iframe changed about a month ago, so wondering if something happened with that, also.

Lastly, if I do an enterprises.applications.get for my app, I see the following (for this field, there are others I have set up):

{
      "key": "autoLaunch",
      "type": "BOOL",
      "title": "Auto launch?",
      "defaultValue": false
},

Appreciate the help!


Solution

  • It seems that the API does not properly parse the defaultValue of BOOL restrictionType when a bool reference is used.

    For now, I recommend using either a string reference (<string name="key_string_default">true</string>) or an integer reference (<integer name="key_integer_default">1</integer>), and avoid using bool reference.