Enterprise Configuration ionic

If you want to configure EMM (Enterprise Mobility Management) variables on your ios and android devices for use with cordova, you can do this with the cordova-plugin-emm-app-config plugin.

It is requires a few steps to set up:

Install the plugin

You can do this by running these commands:

ionic cordova plugin add cordova-plugin-emm-app-config
npm install @ionic-native/emm-app-config

Configure Android

You will have to specify which keys you want to be able to configure using the app. You can do this by adding some lines to config.xml

<?xml version='1.0' encoding='utf-8'?>
<widget id="com.example.app" version="1.0.2" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    ...
    <platform name="android">
        <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
            ...
        </edit-config>
        <edit-config file="app/src/main/AndroidManifest.xml" mode="add" target="/manifest/application" xmlns:android="http://schemas.android.com/apk/res/android">
            <meta-data android:name="android.content.APP_RESTRICTIONS" android:resource="@xml/app_restrictions" />
        </edit-config>
        <resource-file src="resources/android/xml/app_restrictions.xml" target="app/src/main/res/xml/app_restrictions.xml" />
        ...
    </platform>
    ...
</widget>

Next to this, you will have to add a app_restrictions.xml file.

<?xml version="1.0" encoding="utf-8"?>
<restrictions xmlns:android="http://schemas.android.com/apk/res/android">
    <restriction android:key="emailAddress" android:title="emailAddress" android:restrictionType="string" />
</restrictions>

Configure iOS

It seems iOS doesn't need special configuration.

Android Debugging

When you have added Android, and maybe even set a default value for your key, it will not automatically give you this value when you call it. You must deploy the app within a managed context. For Android you can do this with the Test DPC app. You can download this app from some app website or and drag it into your emulator to install it. After this, you must mark the app as administrator app. This can be done via settings>security>admin app.

Next, you must change the device owner. If you are logged into the emulator device, you should log out via settings> account. Then you can run this command:

adb shell dpm set-device-owner com.afwsamples.testdpc/.DeviceAdminReceiver

Now you can start the app, navigate to Apps management/Managed configurations, select your app and set the key/value to what you have previously defined in the code. Hit save (twice) and you should be good to go.

A screenshot of the Test DPC app, setting the key/value pair of the mmc configuration
Introductie FocusgroepSecurity of passwords