Android Studio 默认 XML 布尔值未用于托管配置设置

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

这是一个简单的问题:我使用 Android Mgmt。 API 用于现场的完全托管设备(Android 平板电脑)。通过它,我在代码中定义了许多托管配置设置。有一些布尔值都默认为 false 除了一个:

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

当我大约一年前设置它时,我很确定它工作正常。然而,最近,我在我构建的 MDM 中创建了一个策略,它查询显示所有设置的 Google Managed Config iframe。 autoLaunch 字段默认为 false。

bool 默认值@bool/auto_launch_default 定义在res/values/bools.xml:

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

如果可能的话,我想继续使用这种格式。我真的只是想知道为什么这不再有效,如果有人对此有任何意见。我确实记得大约一个月前我的托管配置 iframe 的格式发生了变化,所以想知道是否也发生了什么事。

最后,如果我为我的应用程序执行 enterprises.applications.get,我会看到以下内容(对于此字段,我还设置了其他字段):

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

感谢帮助!

当使用 bool 引用时,API 似乎没有正确解析 BOOL restrictionType 的默认值。

目前,我建议使用字符串引用 (<string name="key_string_default">true</string>) 或整数引用 (<integer name="key_integer_default">1</integer>),并避免使用布尔引用。