The requirement is to create a key-value pair and add to the app configuration policy at portal side. ex. endpointURL : "some-value"
The Android app should be configured in a way that it should access this configurations in the app and should be able to set the endpointURL in app.
I followed below steps at this link to Support App configuration policies in the app :
Added the permissions to AndroidManifest.xml:
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
I have pasted below code inside LoginServiceImpl.java where I am setting endpoint URL.
MAMAppConfigManager configManager = MAMComponents.get(MAMAppConfigManager.class);
String identity = "<user-name>@mobileinfy.onmicrosoft.com";
//
MAMAppConfig appConfig = configManager.getAppConfig(identity); //<= this line returning null.
Log.i("App Config Data = ",(appConfig == null ? "null" : appConfig.getFullData().toString()));
String valueToUse = null;
if (appConfig.hasConflict("endpointURL")) // <=So getting Exception at this line NullPointerException
{
List<String> values = appConfig.getAllStringsForKey("ServerUrl");
for (String value : values) {
valueToUse = value;
}
} else {
valueToUse = appConfig.getStringForKey("endpointURL ", MAMAppConfig.StringQueryType.Any);
}
Log.i("Found value " , valueToUse);
I followed the steps at this link to add app configuration policies in Intune portal
Steps that I followed to test app : 1.Installed company portal and logged in using our Intune account id:@mobileinfy.onmicrosoft.com 2. Installed app using android studio 3. Tried to log in -> app crashed. (as exception occurred.)
Another set of steps to test app : 1. Generated apk -> uploaded to intune portal 2. Installed company portal and logged in using our Intune account id: ayush14197@mobileinfy.onmicrosoft.com 3. Assigned app config policies to this app and synced. 4. Tried installing app from company portal app. 5. Tried to log in -> app crashed. (as exception occurred.)
Could you please help me to get this issue resolved? Thanks in advance.