androidnativescriptandroid-restrictions

Implementing managed configurations in NativeScript


I am developing a NativeScript app for android and wish to implement managed configurations as described here: https://developer.android.com/work/managed-configurations.html.

I have tried adding app_restrictions.xml to the App_Resources/Android/values folder but I get the following build error:

Execution failed for task ':mergeF0F1DebugResources'. Error: Unsupported type 'restriction'

This is the content of app_restrictions.xml:

<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
  <restriction
    android:key="downloadOnCellular"
    android:restrictionType="bool"
    android:defaultValue="true" />
</restrictions>

Does NativeScript support adding restrictions like this? If so, how do I add the restriction resource file. If not, is there some other way to implement managed configurations?

EDIT: Solved by pkanev in the comments. The restrictions file must be placed in App_Resources/Android/xml.


Solution

  • Per the official Android documentation - https://developer.android.com/work/managed-configurations.html the restrictions configuration needs to be placed in res/xml dir, which corresponds to app/App_Resources/Android/xml in a NativeScript Android app.