Skip to main content

Get a result

Deciding what to do once a result is ready is similar to launching the verification. First, you must connect to your Result Endpoint to decide the flow's next step. And finally, based on your server's response, you show the corresponding UI and process the result accordingly.

Step 1: Defining the next step

Use the startForResult object you created in the previous step to trigger your request to the Result Endpoint. Here's an example of how you would do so using a ViewModel:

private val viewModel: MyViewModel by viewModels()

private val startForResult =
registerForActivityResult(VerificationResultContract()) { result: String? ->
if (result != null) {
// Make a request to the Result Endpoint
viewModel.getVerificationResult()
} else {
// In this example, we assume the user cancelled the verification
viewModel.resetFlow()
}
}

Step 2: Update your UI

Once your server responds, you can use the verification result to follow one of these paths:

  1. Show an error if the verification process was unsuccessful.
  2. If the user verified their number correctly, move to the next step of the journey.

Next steps

Now that your implementation is complete, you can add phone verification to more flows within your app or integrate the SDK with other platforms.

Customization

If you haven't already, we recommend customizing your API key so that the UI matches your brand. Also, consider creating multiple API keys for your and your team's different environments.


Go to styling guide 🎨

Support

tip

Questions? Comments? Something is missing? If you have questions, Contact us. We welcome your feedback and suggestions.