I am building a hybrid app with Ionic/Cordova and am using a plugin (https://github.com/apla/me.apla.cordova.app-preferences) to retrieve a username value from the Root.plist file contained in Settings.bundle.
I am having difficulty sending this value through AirWatch (MDM Solution) and then properly reading it during runtime. I am using the Application Configuration setting while deploying the app as shown below:
In the AirWatch Console:
Root.plist Source Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>Key</key>
<string>AWUsername</string>
<key>DefaultValue</key>
<dict>
<key>Value</key>
<string>Test</string>
</dict>
</dict>
</array>
</dict>
</plist>
JS
var retrieveUser = function () {
var prefs = window.plugins.appPreferences;
//prefs.fetch (ok, fail, 'dict', 'key');
prefs.fetch(prefReadSucess, prefReadFailed, 'AWUsername', 'AWUsername');
function prefReadSucess(value) {
console.log("User: " + value);
DataTransfer.getUser(value);
}
function prefReadFailed(error) {
console.log("Error: " + error);
DataTransfer.getUser("ANONYMOUS");
}
};
retrieveUser();
With the code mentioned above, the result is that I get the value "Test" where the username should be populating. I have tried numerous variations in the Root.plist file but cannot seem to pair the AirWatch App Config Key to the key located in the Root.plist file. Help would be greatly appreciated! Please let me know what I am doing wrong and/or how I can fix this. Thanks!