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 use one of the following option:

Option 1 - Enable Multi-User Setting in BrandedSettings.json

This is available for all versions of the client.

  1. Enable Multi-User setting 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.

Option 2 - Setting User Mode via Settings Exchange and QR Code

This option is only available for client version 6.3 or newer and Cloud Foundry mobile services.

  1. 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. This flag ensures that any pending offline changes from previous user are securely uploaded to the OData service. This is especially vital when the previous user has not uploaded the offline changes, and the app is being switched to a new user.

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

Multi-user parameter in the generated QR code is either set to true or false based on the flag Allow Upload of Pending Changes from Previous User. The client will set the user mode based on the scanned QR code. Users can dynamically switch between user modes by scanning the 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

Tutorial

Enable Multi-User Mode for Mobile Development Kit Application.


Last update: February 26, 2024