Can Ionic or ngCordova Support Managed App Configuration?

Hello,

I am trying to grab and store the username string value from my MDM (AirWatch). I have been told this can be achieved by using Managed App Configuration and was wondering if ionic or cordova can support this?

If not, is there anyone who has worked with the Managed App Config and can point me in the right direction?

Thanks,

Andy

SOLUTION:

For anyone looking to implement this functionality

After researching the different plugins, the one you linked is definitely the best one out there ( https://github.com/apla/me.apla.cordova.app-preferences ). Although the documentation is somewhat lacking (or was at least difficult for me to get started) so here are the things I did that were not mentioned:

After installing the plugin, run:

$ cordova prepare

This will generate a Settings.bundle file for you to put your key values in to.

Then go to platforms/ios/Settings.bundle and copy this into your xcode project Resources directory.

For whatever reason I still had some difficulty reading the keys so here is the structure I used for my Root.plist file:

<plist version="1.0">
<dict>
	<key>PreferenceSpecifiers</key>
	<array>
		<dict>
			<key>Type</key>
			<string>PSTitleValueSpecifier</string>
			<key>DefaultValue</key>
			<string>Mango Farmer</string>
			<key>Key</key>
			<string>username</string>
		</dict>
	</array>
	<key>StringsTable</key>
	<string>Root</string>
</dict>
</plist>

And in my app.js file here is the structure of the controller:

app.controller('GetUsername', function($scope) {

  $scope.testPref = function () {

  var prefs = window.plugins.appPreferences;
  prefs.fetch(prefReadSucess, prefReadFailed, 'username');

  function prefReadSucess(value) {
      console.log(value);
  }

  function prefReadFailed(error) {
      console.log(error);
  }
};
});

Hope that helps anyone interested!

Hi, I’ve never used Managed App Config.
This plugin ( https://github.com/apla/me.apla.cordova.app-preferences ) seems to be able to modify native preferences and might be of use to you.

1 Like

Thank you very much. This appears to be what I am looking for. I’ll come back and share my results at a later time.

For anyone looking to implement this functionality

After researching the different plugins, the one you linked is definitely the best one out there ( https://github.com/apla/me.apla.cordova.app-preferences ). Although the documentation is somewhat lacking (or was at least difficult for me to get started) so here are the things I did that were not mentioned:

After installing the plugin, run:

$ cordova prepare

This will generate a Settings.bundle file for you to put your key values in to.

Then go to platforms/ios/Settings.bundle and copy this into your xcode project Resources directory.

For whatever reason I still had some difficulty reading the keys so here is the structure I used for my Root.plist file:

<plist version="1.0">
<dict>
	<key>PreferenceSpecifiers</key>
	<array>
		<dict>
			<key>Type</key>
			<string>PSTitleValueSpecifier</string>
			<key>DefaultValue</key>
			<string>Mango Farmer</string>
			<key>Key</key>
			<string>username</string>
		</dict>
	</array>
	<key>StringsTable</key>
	<string>Root</string>
</dict>
</plist>

And in my app.js file here is the structure of the controller:

app.controller('GetUsername', function($scope) {

  $scope.testPref = function () {

  var prefs = window.plugins.appPreferences;
  prefs.fetch(prefReadSucess, prefReadFailed, 'username');

  function prefReadSucess(value) {
      console.log(value);
  }

  function prefReadFailed(error) {
      console.log(error);
  }
};
});

Hope that helps anyone interested!

@Shredmer, Thank you for reporting back!

Thank you for the information. if you dont mind, I would like to know what settings did you need to perform on airwatch for getting username?

@Shredmer, how can you take the username from MDM in our ionic app?