🎓beginner⏱30 min.SAP BTP Sdk For AndroidBeginnerAndroidMobileSAP Business Technology Platform
You will learn
โHow to change passcode with the Flows component
โHow to handle forgetting passcode scenario with the Flows Component
โHow to verify passcode with the Flows component [ACCORDION-BEGIN [Step 1: ](Handle passcode change with the Flows component)] [OPTION BEGIN [Java]] 1. Open the project you previously created using the SAP BTP SDK Wizard for Android. 2. In Android Studio, on Windows, press Ctrl+N, or, on a Mac, press command+O, and type SettingsFragment to open SettingsFragment.java. 3. On Windows, press Ctrl+F12, or, on a Mac, press command+F12, and type onCreatePreferences to move to the onCreatePreferences method. To start the flow to change passcode, the flow type must be FlowType.CHANGEPASSCODE for the FlowContext instance. Upon starting the flow with this FlowContext instance, the entire process to change passcode will be handled automatically. !Change passcode flow4. The “change passcode” flow will firstly display the sign-in screen for user to input current passcode. When sign-in is successful with correct passcode, the flow will open “Create Passcode” and “Verify Passcode” screens for user to input and verify the new passcode. The subsequent step is optional, when biometric authentication is enabled in the passcode policy and is also supported on the device, the “Enable Biometric” screen will be displayed. User can decide whether or not to enable biometric authentication for this app. Then the flow is finished and the new passcode will take effect. !Change passcode screensNotice that in the sign-in screen of a “change passcode” flow, the FORGOT PASSCODE? button is invisible and the SWTICH OR ADD USER button in multi-user mode is also invisible. [OPTION END] [OPTION BEGIN [Kotlin]] 1. Open the project you previously created using the SAP BTP SDK Wizard for Android. 2. In Android Studio, on Windows, press Ctrl+N, or, on a Mac, press command+O, and type SettingsFragment to open SettingsFragment.kt. 3. On Windows, press Ctrl+F12, or, on a Mac, press command+F12, and type onCreatePreferences to move to the onCreatePreferences method. To start the flow to change passcode, the flow type must be FlowType.CHANGEPASSCODE for the FlowContext instance. Upon starting the flow with this FlowContext instance, the entire process to change passcode will be handled automatically. !Change passcode flow4. The “change passcode” flow will firstly display the sign-in screen for user to input current passcode. When sign-in is successful with correct passcode, the flow will open “Create Passcode” and “Verify Passcode” screens for user to input and verify the new passcode. The subsequent step is optional, when biometric authentication is enabled in the passcode policy and is also supported on the device, the “Enable Biometric” screen will be displayed. User can decide whether or not to enable biometric authentication for this app. Then the flow is finished and the new passcode will take effect. !Change passcode screensNotice that in the sign-in screen of a “change passcode” flow, the FORGOT PASSCODE? button is invisible and the SWTICH OR ADD USER button in multi-user mode is also invisible. [OPTION END] [VALIDATE_1] [ACCORDION-END] [ACCORDION-BEGIN [Step 2: ](Handle forgetting passcode with the Flows component)] [OPTION BEGIN [Java]] 1. In the app generated from the SAP BTP SDK Wizard for Android, there is a FORGOT PASSCODE? button on the sign-in screen. When the app is locked and user forgot the passcode to unlock the app, user can click this button to start a “forgot passcode” flow and reset the passcode. !Forgot passcode button2. The “forgot passcode” flow actually starts an onboarding flow. The differences between a “forgot passcode” flow and a standard onboarding flow are:
โThe EULA screen is always excluded in the “forgot passcode” flow.
โThe “forgot passcode” flow remembers the user ID that is performing the “forgot passcode” action and if the user tries to onboard with another user ID, the flow will terminate with a warning dialog. !Forgot passcode warning3. To start a “forgot passcode” flow, set the flow type as FlowType.FORGOT_PASSCODE and set the user ID who forgot the passcode for the FlowContext instance, and then call the start method of the Flow class to start the flow. Java FlowContext flowContext = new FlowContextBuilder() .setApplication(new AppConfig.Builder().applicationId("app_id").addAuth( new BasicAuth()).build()) .setFlowType(FlowType.FORGOT_PASSCODE) .setForgotPasscodeUserId("TestUser") .build(); Flow.start(this, flowContext); [OPTION END] [OPTION BEGIN [Kotlin]] 1. In the app generated from the SAP BTP SDK Wizard for Android, there is a FORGOT PASSCODE? button on the sign-in screen. When the app is locked and user forgot the passcode to unlock the app, user can click this button to start a “forgot passcode” flow and reset the passcode. !Forgot passcode button2. The “forgot passcode” flow actually starts an onboarding flow. The differences between a “forgot passcode” flow and a standard onboarding flow are:
โThe EULA screen is always excluded in the “forgot passcode” flow.
โThe “forgot passcode” flow remembers the user ID that is performing the “forgot passcode” action and if the user tries to onboard with another user ID, the flow will terminate with a warning dialog. !Forgot passcode warning3. To start a “forgot passcode” flow, set the flow type as FlowType.FORGOT_PASSCODE and set the user ID who forgot the passcode for the FlowContext instance, and then call the start method of the Flow class to start the flow. Kotlin val flowContext = FlowContextBuilder() .setApplication(AppConfig.Builder().applicationId("app_id") .addAuth(BasicAuth()) .build()) .setFlowType(FlowType.FORGOT_PASSCODE) .setForgotPasscodeUserId("TestUser") .build() Flow.start(this, flowContext) [OPTION END] [VALIDATE_2] [ACCORDION-END] [ACCORDION-BEGIN [Step 3: ](Handle passcode verification with the Flows component)] [OPTION BEGIN [Java]] 1. Users might be asked to enter passcode or authenticate with biometric again before modifying some sensitive information in the app. The “verify passcode” flow is designed for this purpose. 2. To start a “verify passcode” flow, set the flow type as FlowType.VERIFY_PASSCODE and then call the start method of the Flow class to start the flow. Java FlowContext flowContext = new FlowContextBuilder() .setApplication(new AppConfig.Builder().applicationId("app_id").addAuth( new BasicAuth()).build()) .setFlowType(FlowType.VERIFY_PASSCODE) .build(); Flow.start(this, flowContext); 3. When biometric authentication is enabled by the user, the flow will display the “Sign In with Biometric” screen for user to authenticate with biometric information. !Unlock with biometricOtherwise, the flow will display the sign-in screen for user to input passcode. Notice that unlike the sign-in screen used for app unlock, the FORGOT PASSCODE button and the SWITH OR ADD USER button in multi-user mode are always invisible for the sign-in screen of a “verify passcode” flow. !Passcode verification[OPTION END] [OPTION BEGIN [Kotlin]] 1. Users might be asked to enter passcode or authenticate with biometric again before modifying some sensitive information in the app. The “verify passcode” flow is designed for this purpose. 2. To start a “verify passcode” flow, set the flow type as FlowType.VERIFY_PASSCODE and then call the start method of the Flow class to start the flow. Kotlin val flowContext = FlowContextBuilder() .setApplication(AppConfig.Builder().applicationId("app_id") .addAuth(BasicAuth()) .build()) .setFlowType(FlowType.VERIFY_PASSCODE) .build() Flow.start(this, flowContext) 3. When biometric authentication is enabled by the user, the flow will display the “Sign In with Biometric” screen for user to authenticate with biometric information. !Unlock with biometricOtherwise, the flow will display the sign-in screen for user to input passcode. Notice that unlike the sign-in screen used for app unlock, the FORGOT PASSCODE button and the SWITH OR ADD USER button in multi-user mode are always invisible for the sign-in screen of a “verify passcode” flow. !Passcode verification[OPTION END] Congratulations! You now have learned how to handle your passcode with the Flows component! [DONE] [ACCORDION-END]
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.
How to handle forgetting passcode scenario with the Flows Component
How to verify passcode with the Flows component
Step 1Handle passcode change with the Flows component
โ
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, press command+O, and type SettingsFragment to open SettingsFragment.java.
On Windows, press Ctrl+F12, or, on a Mac, press command+F12, and type onCreatePreferences to move to the onCreatePreferences method. To start the flow to change passcode, the flow type must be FlowType.CHANGEPASSCODE for the FlowContext instance. Upon starting the flow with this FlowContext instance, the entire process to change passcode will be handled automatically.
!Change passcode flow
The “change passcode” flow will firstly display the sign-in screen for user to input current passcode. When sign-in is successful with correct passcode, the flow will open “Create Passcode” and “Verify Passcode” screens for user to input and verify the new passcode. The subsequent step is optional, when biometric authentication is enabled in the passcode policy and is also supported on the device, the “Enable Biometric” screen will be displayed. User can decide whether or not to enable biometric authentication for this app. Then the flow is finished and the new passcode will take effect.
!Change passcode screens
Notice that in the sign-in screen of a “change passcode” flow, the FORGOT PASSCODE? button is invisible and the SWTICH OR ADD USER button in multi-user mode is also invisible.
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, press command+O, and type SettingsFragment to open SettingsFragment.kt.
On Windows, press Ctrl+F12, or, on a Mac, press command+F12, and type onCreatePreferences to move to the onCreatePreferences method. To start the flow to change passcode, the flow type must be FlowType.CHANGEPASSCODE for the FlowContext instance. Upon starting the flow with this FlowContext instance, the entire process to change passcode will be handled automatically.
!Change passcode flow
The “change passcode” flow will firstly display the sign-in screen for user to input current passcode. When sign-in is successful with correct passcode, the flow will open “Create Passcode” and “Verify Passcode” screens for user to input and verify the new passcode. The subsequent step is optional, when biometric authentication is enabled in the passcode policy and is also supported on the device, the “Enable Biometric” screen will be displayed. User can decide whether or not to enable biometric authentication for this app. Then the flow is finished and the new passcode will take effect.
!Change passcode screens
Notice that in the sign-in screen of a “change passcode” flow, the FORGOT PASSCODE? button is invisible and the SWTICH OR ADD USER button in multi-user mode is also invisible.
Step 2Handle forgetting passcode with the Flows component
+
In the app generated from the SAP BTP SDK Wizard for Android, there is a FORGOT PASSCODE? button on the sign-in screen. When the app is locked and user forgot the passcode to unlock the app, user can click this button to start a “forgot passcode” flow and reset the passcode.
!Forgot passcode button
The “forgot passcode” flow actually starts an onboarding flow. The differences between a “forgot passcode” flow and a standard onboarding flow are:
The EULA screen is always excluded in the “forgot passcode” flow.
The “forgot passcode” flow remembers the user ID that is performing the “forgot passcode” action and if the user tries to onboard with another user ID, the flow will terminate with a warning dialog.
!Forgot passcode warning
To start a “forgot passcode” flow, set the flow type as FlowType.FORGOT_PASSCODE and set the user ID who forgot the passcode for the FlowContext instance, and then call the start method of the Flow class to start the flow.
In the app generated from the SAP BTP SDK Wizard for Android, there is a FORGOT PASSCODE? button on the sign-in screen. When the app is locked and user forgot the passcode to unlock the app, user can click this button to start a “forgot passcode” flow and reset the passcode.
!Forgot passcode button
The “forgot passcode” flow actually starts an onboarding flow. The differences between a “forgot passcode” flow and a standard onboarding flow are:
The EULA screen is always excluded in the “forgot passcode” flow.
The “forgot passcode” flow remembers the user ID that is performing the “forgot passcode” action and if the user tries to onboard with another user ID, the flow will terminate with a warning dialog.
!Forgot passcode warning
To start a “forgot passcode” flow, set the flow type as FlowType.FORGOT_PASSCODE and set the user ID who forgot the passcode for the FlowContext instance, and then call the start method of the Flow class to start the flow.
Step 3Handle passcode verification with the Flows component
+
Users might be asked to enter passcode or authenticate with biometric again before modifying some sensitive information in the app. The “verify passcode” flow is designed for this purpose.
To start a “verify passcode” flow, set the flow type as FlowType.VERIFY_PASSCODE and then call the start method of the Flow class to start the flow.
When biometric authentication is enabled by the user, the flow will display the “Sign In with Biometric” screen for user to authenticate with biometric information.
!Unlock with biometric
Otherwise, the flow will display the sign-in screen for user to input passcode. Notice that unlike the sign-in screen used for app unlock, the FORGOT PASSCODE button and the SWITH OR ADD USER button in multi-user mode are always invisible for the sign-in screen of a “verify passcode” flow.
!Passcode verification
Users might be asked to enter passcode or authenticate with biometric again before modifying some sensitive information in the app. The “verify passcode” flow is designed for this purpose.
To start a “verify passcode” flow, set the flow type as FlowType.VERIFY_PASSCODE and then call the start method of the Flow class to start the flow.
When biometric authentication is enabled by the user, the flow will display the “Sign In with Biometric” screen for user to authenticate with biometric information.
!Unlock with biometric
Otherwise, the flow will display the sign-in screen for user to input passcode. Notice that unlike the sign-in screen used for app unlock, the FORGOT PASSCODE button and the SWITH OR ADD USER button in multi-user mode are always invisible for the sign-in screen of a “verify passcode” flow.
!Passcode verification
Congratulations! You now have learned how to handle your passcode with the Flows component!
Share feedback on this tutorial or join the conversation in SAP Community.
Submit detailed feedbackDiscuss in Community
Steps
Step 1 of 3
1. Handle passcode change with the Flows component2. Handle forgetting passcode with the Flows component3. Handle passcode verification with the Flows component
Joule
AI Notice
Joule is an AI assistant. Generative AI may produce inaccurate, incomplete, or biased information. Always verify important details before acting on them.
Conversations are sent to SAP-hosted large language models for processing. Do not include personal data, credentials, or confidential information in your messages.
Joule's responses are based on the SAP tutorial catalog and may not reflect the latest product changes. For authoritative guidance, consult the linked tutorials and official SAP documentation.