Overview
You will learn
- How to import the Flows component into the application project
- How the Flows APIs are used in wizard-generated applications
- Which screens are provided by the Flows component The Flows component is a new feature of the SAP BTP SDK for Android as of version 3.1 and new features are continually added to the library. The Flows component can reduce and simplify the application code related to the onboarding process, passcode management, and restore and reset scenarios. In addition to providing a default implementation, it also supports options for UI customization and extension points for client code to contribute customized logic. See Onboarding Using the Flow Component of the SAP SDK for Android for an overview.
Prerequisites
- You have Set Up a BTP Account for Tutorials. Follow the instructions to get an account, and then to set up entitlements and service instances for the following BTP services.
- SAP Mobile Services
- You completed Try Out the SAP BTP SDK Wizard for Android.
Steps
Details
You will learn
- How to import the Flows component into the application project
- How the Flows APIs are used in wizard-generated applications
- Which screens are provided by the Flows component
The Flows component is a new feature of the SAP BTP SDK for Android as of version 3.1 and new features are continually added to the library. The Flows component can reduce and simplify the application code related to the onboarding process, passcode management, and restore and reset scenarios. In addition to providing a default implementation, it also supports options for UI customization and extension points for client code to contribute customized logic. See Onboarding Using the Flow Component of the SAP SDK for Android for an overview.
Open the project you previously created using the SAP BTP SDK Wizard for Android.
Press
Shifttwice and typebuild.gradleto open thebuild.gradlefile of the app module.Go to the
dependenciessection and find the dependency declaration to the Flows component.onboardingcontains the UI screens andflowsv2contains the Flows API and logic.!

App gradle file
Open the project you previously created using the SAP BTP SDK Wizard for Android.
In Android Studio, on Windows, press
Ctrl+N, or, on a Mac, presscommand+O, and typeWelcomeActivityto openWelcomeActivity.java.On Windows, press
Ctrl+F12, or, on a Mac, presscommand+F12, and typestartFlowto move to thestartFlowmethod. To start the onboarding process, firstly create aFlowContextinstance that contains the information required by the flow, such as the application information, the status of multi-user mode, the flow state listener, etc. Then call thestartmethod of theFlowclass to start the onboarding flow, allowing the entire onboarding process to be handled automatically.!

Flow starting method Notice that by default, the type of a flow is
FlowType.ONBOARDING. To start a different type of flow, such as aChange Passcodeflow, the client code must specify the flow type in theFlowContextinstance. Besides the parameters specified above, there are also many other parameters in theFlowContextclass that can be modified to allow the client code to customize a flow. When the values of the parameters are not specified in the client code, the default values will be used. The details of all parameters in theFlowContextclass will be explained in subsequent tutorials.FlowStateListeneris a parameter in theFlowContextclass. Using the callbacks defined in the listener, client code can insert logic at certain points during the flow process. For example, after the client policy is retrieved, the client code can retrieve the information that will be used by the app. In Android Studio, on Windows, pressCtrl+N, or, on a Mac, presscommand+O, and typeWizardFlowStateListenerto openWizardFlowStateListener.java. This class is a sample implementation for the callbacks defined in theFlowStateListenerclass. The details ofFlowStateandFlowStateListenerwill be explained in subsequent tutorials.
Open the project you previously created using the SAP BTP SDK Wizard for Android.
In Android Studio, on Windows, press
Ctrl+N, or, on a Mac, presscommand+O, and typeWelcomeActivityto openWelcomeActivity.kt.On Windows, press
Ctrl+F12, or, on a Mac, presscommand+F12, and typestartFlowto move to thestartOnboardingmethod. To start the onboarding process, firstly create aFlowContextinstance that contains the information required by the flow, such as the application information, the status of multi-user mode, the flow state listener, etc. Then call thestartmethod of theFlowclass to start the onboarding flow, allowing the entire onboarding process to be handled automatically.!

Flow starting method Notice that by default, the type of a flow is
FlowType.ONBOARDING. To start a different type of flow, such as aChange Passcodeflow, the client code must specify the flow type in theFlowContextinstance. Besides the parameters specified above, there are also many other parameters in theFlowContextclass that can be modified to allow the client code to customize a flow. When the values of the parameters are not specified in the client code, the default values will be used. The details of all parameters in theFlowContextclass will be explained in subsequent tutorials.FlowStateListeneris a parameter in theFlowContextclass. Using the callbacks defined in the listener, client code can insert logic at certain points during the flow process. For example, after the client policy is retrieved, the client code can retrieve the information that will be used by the app. In Android Studio, on Windows, pressCtrl+N, or, on a Mac, presscommand+O, and typeWizardFlowStateListenerto openWizardFlowStateListener.kt. This class is a sample implementation for the callbacks defined in theFlowStateListenerclass. The details ofFlowStateandFlowStateListenerwill be explained in subsequent tutorials.
The Flows component provides the required UI screens for the onboarding process and passcode management, including the end user license agreement (EULA) screen for the user to understand and agree to the terms of using the app, the QR scan screen to get the application configuration, the sign-in screen for user authentication, and passcode screens for the user to create and confirm their passcode.
There are different combinations of the screens depending on the different application configuration and user options in the
FlowContextinstance. The following sequence of screens demonstrate the onboarding process of the project previously generated by the wizard. The details for how to customize the screens and include or exclude a screen in a flow will be explained in subsequent tutorials.
Onboarding steps screen
Congratulations! You now understand the basic concepts of the Flows component and have examined its usage in the project created using the SAP BTP SDK Wizard for Android!
Resources
Discussion
Share feedback on this tutorial or join the conversation in SAP Community.