androidmdmandroid-management-apiandroid-enterpriseandroid-for-work

How to set up Managed Configurations and retrieve the data with RestrictionManager


Setting up Android Enterprise's AMAPI, i have an application that needs to receive information from the AMAPI service (such as urls and texts), when refering to the documentation for Managed Configurations set up in ApplicationPolicy, it states that These are arbitrary settings that can be changed by a managed configuration provider. In order to change the restrictions set up in my xml file, done as the doc instructs:

<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
<restriction
    android:key="test"
    android:title="test"
    android:restrictionType="string"
    android:description="@string/app_name"
    android:defaultValue="defaultValue"/>
</restrictions>

we've added a ManagedConfigurationTemplate into our ApplicationPolicy with the values needed:

"managedConfiguration": null,
  "managedConfigurationTemplate": {
    "configurationVariables": {
      "test": "string"
    },
    "templateId": null
  },
  "minimumVersionCode": null,
  "packageName": "com.navita.smartinventory",
  "permissionGrants": null,
  "workProfileWidgets": null

However these configurationVariables do not show in the app configured by this policy, RestrictionManager returns an EmptyBundle. So the questions are can RestrictionManager read these ConfigurationVariables? And in order to receive values from AMAPI into the app, does the managedConfig iFrame need to be set up? Am i forced into using a Managed Configuration Provider application for this? Finally, is this the best way to exchange data from the policies to the application without the use of an managed configuration provider application?

The device this was tested on was provisioned as fully managed and had all the policies from the EMM enforced.


Solution

  • As a general rule of thumbs, managed configurations are intended for parameters that you want to configure in your application (a proxy URL or enabling / disabling part of it). You can use it to send information to an application but it may not be the best option in terms of latency or error handling.

    Also, keep in mind that you can use TestDPC to test your apps managed configuration locally on a device just to sort out any Android-side issue.

    I'll try to answer your questions:

      {
       "managedProperty": [
            {
                "key": "test",
                "valueString": "This is a test value"
            }
       ],
       "minimumVersionCode": null,
       "packageName": "com.navita.smartinventory",
       "permissionGrants": null,
       "workProfileWidgets": null
      }