2

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.

1 Answers1

0

I think you're hitting two issues that aren't well documented in the Intune APP SDK docs:

  1. MAMAppConfigManager.getAppConfig can return null if no app config data has been receieved for the user. The example given should be performing a null check on appConfig.
  2. To receive app config, the user must have MAM policy targeted for at least one app for app config to be delivered. This is mentioned, but only on the Managed Browser app config page even though it applies to all apps.

I hope that helps -- these documentation issues should be fixed in the next release of the SDK.

bannus
  • 405
  • 4
  • 6
  • Thanks for answering bannus. I already selected my lob app in targeted app. Can we selected anyone from the list?eg: outlook or browser. Is it needed to associate app for Managing App config? – Ashish Bhimte Mar 07 '19 at 03:40
  • Tried the steps in your link, but no success. – Ashish Bhimte Mar 07 '19 at 10:42
  • It shouldn't matter which app is targeted, as long as you have at least one targeted at the user. After you sign in to the app, can you [collect Company Portal logs](https://learn.microsoft.com/en-us/intune-user-help/send-logs-to-your-it-admin-by-email-android) and email them to wintunedroidfbk@microsoft.com? – bannus Mar 08 '19 at 17:19