Skip to content

Multi User

Mobile Development Kit Client now supports multi-user login capability. This means a Mobile Development Kit Client app on a device can now securely be shared across multiple users. Features such as adding a new user, switching between user sessions, searching for a particular user are supported by the client.

To enable multi-user mode and dynamically switch between single-user and multi-user modes, perform the following steps:

  1. Enable Multi-User settings in BrandedSettings.json. This enables multi-user settings at the client side and initializes the constructs required to support multi-user.

  2. Enable the flag Allow Upload of Pending Changes from Previous User for the app in the mobile services cockpit. In CF this flag is available in Mobile Settings Exchange feature under Shared Devices section. In Neo this flag is available in Client Policies feature under Shared Devices section. This flag ensures that any pending offline changes from previous user are securely uploaded to the service back end. This is especially vital when the previous user has not uploaded the offline changes and app is being switched to a new user.

  3. The client must be rebuilt after enabling the above settings.

  4. Once the client on the device is updated, user must reset the client and login again.

  5. Open the native app and scan the QR Code generated under APIs > In-app Scanning Code in the mobile services cockpit.

The generated QR Code contains information that indicate what the flag Allow Upload of Pending Changes from Previous User is set to. The user mode for the session will be set based on the scanned QR Code.

Note

For an existing single user app it is required to rebuild the client with above mentioned setting and enabling the flag in mobile services cockpit. Once the client on a device is updated the user will have to reset the client and re-login before multi-user capability can be enabled.

Along with above mentioned capabilities, here are some more features which can be used while implementing multi-user capabilities:

  • SkipReset flag in Logout action - If set to true the invocation of Logout action will redirect the user to Sign-In screen, by re-entering the passcode user can re-login and can start using the app. In a multi-user scenario each user may want to logout before they hand over the device to a different user. Default value of this flag is false which means the app would be reset clearing stored credentials such as passcode or Touch ID, authentication token, Offline Store. It is recommended to set this flag to true in a multi-user scenario.

  • OnUserSwitch - This event is raised when the user is switched in Multi-User mode and all the pending Offline OData transactions from previous user are successfully synced.

  • isAppInMultiUserMode client API determines if the application is in single or multi user mode. This helps to invoke different action depending on the mode for example Logout action with SkipReset set to true can be invoked in multi-user mode and Logout action with SkipReset set to false can be invoked in single user mode.

While implementing multi-user capabilities, one more aspect you need to consider is the support of push notification in the application. For more information on the best practices for push notification in multi-user mode, see Push Notification for Multi User


Last update: September 12, 2022