Skip to Content

Add a Change Flow

test
0 %
Add a Change Flow
Details
// Explore More Tutorials

Add a Change Flow

Add a change flow enabling a user to trigger the action to change the app's passcode.

You will learn

  • How to add a change flow to an app

In the restore tutorial, it was shown how the application responded to a change made in the management cockpit to the client policy. In the below steps, the user will trigger the action to change their passcode using the change flow.


Step 1: Add the code

Add the following method to MainActivity.java

private void startChangeFlow() {
    LOGGER.debug("starting Change flow");
    // Creating flow and configuring steps
    Flow flow = new Flow("change");
    flow.setSteps(new Step[] {
        new ChangePasscodeStep()  // shows the enter, new, and confirm passcode screens
    });

    flowManagerService.execute(flow, flowContext, new FlowActionHandler() {
        @Override
        public void onFailure(Throwable t) {
            LOGGER.debug("onFailure in change called" + t);
            showAlertDialog("Change", t);
        }

        @Override
        public void onSuccess(FlowContext result) {
            LOGGER.debug("Change flow completed successfully.");
        }
    });
}

The change flow is unique in the sense that it simply uses the existing flowContext from the onboard or restore flow and then adds another step that enables users to change their passcode.

Add the following line to the onChange method.

startChangeFlow();

Ensure that settingsDownloadStep.passcodePolicy = null; is commented out so that a passcode exists for the app. Otherwise onFailure will be called.

Log on to answer question
Step 2: Try it out

To test out the changing passcode functionality, tap the Change button.

Change button

A screen to prompt for the current passcode will be shown.

Enter passcode screen

Then a screen to create a new passcode will appear.

New passcode screen

Finally, the verify passcode screen will be shown.

Confirm passcode screen

Congratulations! The code to perform a change flow has been added enabling a user to change their app’s passcode.

What does the Change flow do?
×

Next Steps

Prerequisites

  • Completed the previous tutorial in this mission which added the reset flow
Back to top