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:
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.
Enable the flag
Allow Upload of Pending Changes from Previous Userfor the app in the mobile services cockpit. In CF this flag is available in
Mobile Settings Exchangefeature under
Shared Devicessection. In Neo this flag is available in
Client Policiesfeature under
Shared Devicessection. 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.
The client must be rebuilt after enabling the above settings.
Once the client on the device is updated, user must reset the client and login again.
Open the native app and scan the QR Code generated under
In-app Scanning Codein 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.
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:
SkipResetflag 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.
isAppInMultiUserModeclient 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
SkipResetset to true can be invoked in multi-user mode and Logout action with
SkipResetset 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