AirWatch Managed AppConfig Sample - Android

Google provides native Android APIs to support managed AppConfig by EMM providers like AirWatch. Review the prerequisites for leveraging AppConfig on the Android platform.

  • AirWatch integration with Android for Work
  • An Android app written as per Google's managed AppConfig guidelines
  • A channel to publish this app to your Android For Work managed devices

 

Airwatch integration with Android for Work

Refer to the Android for Work Integration guide to learn how to integrate Google's Android for Work with your AirWatch environment.

 

Develop an app that supports managed AppConfig on Android

An Android application enabled for leveraging managed AppConfig consists of the following project components.

  1. Find the resource XML file that usually resides inside the res/xml/ folder. It has the following schema and is used to declare all the managed AppConfig keys that are supported by this app. AirWatch can automatically pull the details regarding the keys supported by this app using Google Play APIs.

    <?xml version="1.0" encoding="utf-8"?>
    <restrictions xmlns:android="http://schemas.android.com/apk/res/android">
    
    <restriction
         android:key="awservername"
         android:title="@string/awserver_name_title"
         android:restrictionType="string"
         android:description="@string/awsername_description"
         android:defaultValue="awserver" />
    
    <restriction
         android:key="counter"
         android:title="@string/counter_title"
         android:restrictionType="integer"
         android:description="@string/counter_description"
         android:defaultValue="0" />
    
    </restrictions>

     

  2. This restrictions xml file must be declared under the manifest file of the Android app inside the application tag.

    <application
         android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
         android:label="@string/app_name"
         android:roundIcon="@mipmap/ic_launcher_round"
         android:supportsRtl="true"
         android:theme="@style/AppTheme">
    <meta-data android:name="android.content.APP_RESTRICTIONS"
         android:resource="@xml/app_restrictions" />

     

  3. After an AirWatch administrator imports the app to AirWatch from their Google Play Channel, they can import these keys by selecting the Import Supported Keys option under Edit Application > Send Application Configuration > Load.

Developers must dynamically register their activity to listen for the ACTION_APPLICATION_RESTRICTIONS_CHANGED intent. This step ensures that the app receives any new or updated values corresponding to the managed AppConfig pushed by AirWatch.

IntentFilter restrictionFilter = new IntentFilter(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED);
BroadcastReceiver restrictionReciever = new BroadcastReceiver() {
     @Override
     public void onReceive(Context context, Intent intent) {
          Bundle appRestrictions = restrictionsManager.getApplicationRestrictions();
          
          /*
          Fetch the values of managed application configuration from this bundle and take action
in your app accordingly. */ } };

 

See the sample app:

Developers can locate the implementation of managed AppConfig in our AppConfig sample app.

 

Publish the app enabled for Managed AppConfig on Android

1. In order for an app to fetch an EMM-provided managed AppConfig, Google requires the app to be published at a source from where AirWatch can pull and publish the app to enrolled Android for Work devices. Organizations can either publish the app in the Google Play Store or they can leverage private channels for a limited audience.

2. If your organization does not have Android for Work integration with AirWatch, developers can always leverage the AirWatch SDK to send managed configuration from the AirWatch Console. This approach doesn't require Android for Work setup or publishing your app on the Play Store. Instead, integrate the AirWatch SDK into your app. Find more information on this approach at our Managed AppConfig - SDK article.

 

Publish and update Managed AppConfig for your app in AirWatch

An AirWatch administrator can push the managed AppConfig for their enterprise apps using the following steps:

  1. Import the app from your Corporate Google Play Channel or from the Google Play Store by navigating to Apps > List View > Public > Add Application.
  2. Under the App Assignment section, enable Application Configuration.
  3. Select Load, which is under Import Supported Keys.
  4. If the app is developed as per Google's guidelines and the developer has exposed the managed AppConfig keys correctly, then AirWatch can pull and populate all the keys along with their corresponding key types.
  5. Admins can assign the corresponding values to these keys and select Save and Publish.

 

An AirWatch administrator can update the managed AppConfig for their enterprise apps using the following steps:

  1. Update the values for the managed AppConfig keys by navigating to Edit Application > Assignment > Application Configuration.
  2. Select Save and Publish.
  3. Navigate to the App Details and select More > Send Application Configuration.
  4. If the app is running on devices and the app developers have correctly registered the apps to receive the managed restriction broadcast from Android OS, then apps will receive the updated values pushed by AirWatch.
Have more questions? Submit a request

0 Comments

Article is closed for comments.