Creating Shared Device Apps With The Wizard¶
You require an SAP Business Technology Platform account with administrator privileges to create or edit configuration settings on the SAP Business Technology Platform. If your account does not have administrator privileges, the Wizard controls requiring full permissions are unavailable. See the Wizard screen topics for more information about account restrictions.
Launch the Wizard and follow the prompts to create a shared device(multiple users) app configured with connections to the SAP Business Technology Platform
From the Android Studio Welcome screen, select New SAP BTP Android App.
You can also start the Wizard by opening Android Studio and selecting File > New > New SAP BTP Android App .
Follow the steps in the Wizard, as described below (note that steps i through iv are documented in Creating Apps with the Wizard):
- Maintaining mobile services connection.
- Creating or reusing mobile services application configurations.
- Adding OData services.
- Specifying Android project properties.
- Adding shared devices features.
Adding Shared Device Features¶
Use this page to configure shared devices (also called "Multiple Users Mode").
When you select the Enable Multiple Users checkbox for code generation, the Wizard retrieves the multiple user flag from the server to generate the client app with multiple user mode enabled. Go to the SAP mobile service cockpit and select your app from the app list. Click Mobile Settings Exchange in the assigned features list:
Scroll down to the bottom of the page and verify that the shared device checkbox has been checked.
The generated app provides complete create-read-update-delete (CRUD) access to the OData service data behind the selected app of the SAP Business Technology Platform server. It includes the Fiori logon screens for onboarding to the server as well as the OData and Foundation libraries that are used to consume the service.
The generated client code may look like:
FlowContext flowContext = new FlowContextBuilder() .setApplication(appConfig) .setMultipleUserMode(true) .setFlowStateListener(new WizardFlowStateListener( (SAPWizardApplication) context.getApplication())) .build();
val flowContext = FlowContextBuilder() .setApplication(appConfig) .setMultipleUserMode(true) .setFlowStateListener(WizardFlowStateListener(activity.application as SAPWizardApplication)) .build()
On the first start of the app, the following Welcome screen is displayed:
Tapping the Get Started button triggers the logon flow.
The generated app supports Basic authentication, OAuth2, SAML, or no authentication. The code is generated according to the authentication type of the consumed app, which was set on the server. If the authentication type is Basic, then an Authentication dialog is displayed.
After providing the correct credentials, the app receives the client-side configuration policy from the server containing the required passcode policy. If the app requires passcode protection, then a Create Passcode screen is displayed. This screen also contains information about passcode complexity. After a correct passcode is entered, a verification screen is displayed.
After a passcode is created, the logon flow is complete. The app displays the entity set list that is accessible on the server.
Re-run (quit first) the app and notice that the onboarding process is the same as for single-user mode, except that no biometric authentication screen is shown. After onboarding, put the app in background until the unlock screen appears. In multi-user mode, there is a SWITCH OR ADD USER button at the bottom of the screen.
When the user clicks the button, the user list is displayed. The user can either select an existing user from the list or click the ADD USER icon at the top right of the screen. This will start the onboarding process for the new user.