microsoftconnect/ms-intune-app-sdk-ios

I need to know when the changed policy would be received.

Jason-wonku-Ji opened this issue · 3 comments

Describe the bug:
I have a question about applying the intune SDK to an iOS app.
We implemented it as follows to receive the Intune policy.

NotificationCenter.default.addObserver(self,
selector: #selector(policyDidChange),
name: NSNotification.Name.IntuneMAMPolicyDidChange,
object: IntuneMAMPolicyManager.instance())

@objc func policyDidChange(notification: Notification) {
DispatchQueue.main.async {
// Handle the policy change, update UI or state if necessary
print("Intune MAM policy has changed.")
}
}

However, changing the policy in the intune management site does not call that code in real time.
After several to tens of minutes have passed, the corresponding logic is being called.
In some cases, it may take several hours.

My question is that in the case of Android, when the Intune policy is changed, the user can manually retrieve the changed policy from the company portal app.

However, iOS does not allow such operations in the Authenticator app.
And there doesn't seem to be a function in IntuneMAMPolicyManager or IntuneMAMPolicyDelegate for the client to actively connect to the server and receive policies.

Please check whether I have to wait in a situation where I do not know exactly when the policy will be received with the code implemented above, or if there is another way.

Please let me know if I'm wrong.

To Reproduce
Steps to reproduce the behavior:

  1. get token from MSAL
  2. register account through 'registerAndEnrollAccount'
  3. receive policy and restart app
  4. change policy in intune manage center
  5. I don't know when I will receive changed policy.

Expected behavior:
The changed policy would be received right after change policy.

Screenshots and logs:

  • If applicable, add screenshots to help explain your problem.
  • If your app is experiencing an issue during build, do you have app logs for the crash itself?
  • If your app is experiencing an issue post build, do you have app logs for the crash itself?

Smartphone (please complete the following information):

  • Device: iPhone SE 3rd generation
  • OS: iOS 15.5

Intune App SDK for iOS (please complete the following information):

  • What version of the Intune SDK are you using? Are you using the latest version?
    => 19.0
  • What platform is your app based in (native, Xamarin based, Cordova, etc)?
    => iPAdOS, iOS

If I cannot update the policy directly and must receive the policy using the above logic, is there a way to set the cycle?

According to the guide below, it appears that policy changes are checked every 30 minutes after registering is successful.

https://learn.microsoft.com/en-us/mem/intune/apps/app-protection-policy-delivery

Below is the contents of above guide.

  • App Protection is applied per policy settings. Updates occur based on retry interval

  • Intune Service defined based on user load. Typically 30 mins.

If I have to use this method, is there a way to shorten this gap?

There is not a feature for iOS to get notification immediately. Assuming the user is successfully Intune licensed and enrolled with policies, the notification change will be around 30 mins of the actual policy change.