Menu

Expand
Rate this page:

Twilio Verification SDK for Android - Integration guide

Overview

The following is the high level overview of how the SDK works to simplify the process of validating a phone number within an application running on Android.

Required components

Twilio Verification SDK for Android - Architecture scheme.png

  1. A mobile application with the SDK installed.
  2. A backend service to receive phone numbers from the App and produce a signed JWT
  3. Have access to Twilio Verification API in the backend, have your mobile application’s hash configured within Twilio

High level flow

High level flow

  1. App requests to the backend to sign the phone number.
  2. Backend transforms phone number into a JWT. The JWT is the phone number, signed with the customer’s AUTHY_API_KEY and an expiration time
  3. Backend sends JWT to Android application.
  4. The Android app, with the JWT, starts the verification with the SDK.
  5. Twilio sends a formatted SMS (including a prefix and a hash) to the device.
  6. Twilio Verification SDK reads the SMS in the background and notifies the app. No SMS_READ permission is needed. The app with the provided result will have a verification token that is proof enough that the phone is valid.

Setup

Along this guide we're going to implement a sample app from scratch, integrated with the Twilio Verification SDK and supported by a sample token server.

There’s also a more complete sample app already implemented.

The code can be directly checked out here: Sample app - Token Server

The following guides will help you integrate the SDK step by step

  1. Integrating Twilio Verification SDK using the sample backend

  2. Integrating the Twilio Verification SDK with your own backend

  3. Register your app in Twilio Verification API

  4. SDK Reference

Wrapping up

Once the SDK is integrated in your app and your backend is capable of generating the JWT, you’re good to go.

You can also make use of the Google’s sign-in hint, which auto-fills connected phone numbers for the user and reduce the friction even further. Check out the official documentation or ask our support team for more information on how to use Google’s sign-in hint. Smartlock passwords - Hint Request API

The Twilio Verification Sample App has implemented this feature and is available in github

It will also be implemented in the latest release of the Authy app, starting roll out on May 2017

Download Authy from the Google Play Store

Lucas Vidal Esteban Ibarra Anna Mason
Rate this page:

Need some help?

We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd by visiting Twilio's Stack Overflow Collective or browsing the Twilio tag on Stack Overflow.

Loading Code Sample...
        
        
        

        Thank you for your feedback!

        Please select the reason(s) for your feedback. The additional information you provide helps us improve our documentation:

        Sending your feedback...
        🎉 Thank you for your feedback!
        Something went wrong. Please try again.

        Thanks for your feedback!

        thanks-feedback-gif