Skip to content

Flow Configuration

Besides the extension points where client code can plug in customized logic into the flow process, client code can also change the flow process using different settings, such as choosing the preferred activation method, or choosing how to display warning or information messages, either with a dialog or a toast message, etc.

Mobile Service Static Initialization

SAP SDK for Android provides a service initialization module that allows client code to specify which features to use. The Flows component also relies on some of the services passed into SDKInitializer, for example UsageService and CrashService. The corresponding consent steps will appear in the onboarding flow based on whether the service is initialized with SDKInitializer.

Sample client code:

val services = mutableListOf<MobileService>()
services.add(LogService())
services.add(UsageService())
services.add(CrashService(false))
SDKInitializer.start(this, * services.toTypedArray())
List<MobileService> services = new ArrayList<>();
services.add(new UsageService());
SDKInitializer.INSTANCE.start(this, services.toArray(new MobileService[0]), null);

Configuration Options

The client code can set one of two options to determine which activation method to use to show information messages: either with a dialog or a toast message.

To configure these options, use a child class of FlowOptions.

/**
 * Shows the [Info] message either with a dialog or a [Toast]
 */
open fun infoMessageOption(): InfoMessageOption = InfoMessageOption.TOAST

/**
 * Chooses the activation method: [ActivationOption.CHOOSE_BETWEEN_DS_QR],
 * [ActivationOption.DS_ONLY], or [ActivationOption.QR_ONLY]
 */
open fun activationOption(): ActivationOption = ActivationOption.CHOOSE_BETWEEN_DS_QR

/**
 * The OAuth client id to use for the authentication. In a mobile service application, there
 * might be several OAuth clients defined for OAuth authentication. If one of them is intended
 * to be used as the client, this function should return the id. If it's 'null', or flow cannot
 * find the match, the first one in the OAuth client list will be used.
 */
open fun effectiveOAuthClientId(): String? = null

/**
 * Option to say whether to exclude 'EULA' step from the onboarding flow. 'True' means client
 * code is going to handle the EULA itself.
 */
open fun excludeOnBoardingEulaScreen() = false

/**
 * For multiple user mode, when creating a new account, whether to exclude the 'EULA' or not.
 */
open fun excludeEulaWhenCreateAccount() = excludeEulaWhenCreateAccount

By default, the flow framework uses a toast to display information messages and lets the user choose the activation method, either Discovery Service or QR code.

To use this feature, create an instance of FlowOptions, then save it into FlowContext and start a flow.

val flowContext = FlowContext(flowOptions = MyFlowOptions())
Flow.start(activity, flowContext)
FlowContext flowContext = new FlowContextBuilder()
    .setFlowOptions(new MyFlowOptions())
    .build();
Flow.start(activity, flowContext);

Last update: January 6, 2021