Software Development

Migrate from Digit to Firebase phone authentication for Android

You might be knowing that Fabric is now acquired by Google and if you are using Fabric’s Digit for phone authentication (OTP sms verification) then you probably have received such email.

So its time to migrate from digit to firebase. Let’s get started.

Step 1 : App & Account Linking

You can find complete step by step instruction to migrate your digit app to firebase app here This instructions covers all aspects of migrating digit user accounts to firebase whether you have project on firebase console or not. I highly recommend to read all instructions carefully. It hardly take 2 minutes to read and 1 minute to perform. In our case after performing this steps we started getting our user data in firebase within 15 minutes.

Step 2 : Replace Digit SDK with Firebase SDK

You can skip step 1 and directly start from here only if you are not migrating from digit and just want to integrate firebase phone authentication in your app. At this step you must have project created on firebase console. If you have already added firebase to your android project, That’s fine. If not Instructions here

After adding firebase to your app you should enable phone authentication.

2.1 To enable it, Open project in Firebase console →Authentication → SIGN-IN-METHOD → click on phone → Enable

2.2 Add firebase ui auth dependency to app level build.gradle

// FirebaseUI Auth only
compile 'com.firebaseui:firebase-ui-auth:2.0.1'

Some points to take care of –

  • Make sure you don’t have any compatibility issue after adding this library. Checkout more about compatibility here
  • For example, you are adding firebase ui auth lib com.firebaseui:firebase-ui-auth:2.0.1 and you already have another firebase lib such as or You will have compatibility issue bacause firebase auth lib 2.0.1 and above only works for Firebase/Play Services Version equal or greater than 11.0.1 So in this case you may need to change as or
  • if you get Menifest merger failed error like this

you may need to add tools:replace=”android:value” to <meta-data> element of fabric api key like this and you are good to go.

    android:value="somekeyhere" />

2.3 Now replace Digit code with firebase code.

  • Add this
private static final int RC_SIGN_IN = 123;
private FirebaseAuth auth;
  • And this in your Activity.
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    // RC_SIGN_IN is the request code you passed into startActivityForResult(...) when starting the sign in flow.
    if (requestCode == RC_SIGN_IN) {
        IdpResponse response = IdpResponse.fromResultIntent(data);
        // Successfully signed in
        if (resultCode == ResultCodes.OK) {
            Toast.makeText(this, "OTP verification success", Toast.LENGTH_SHORT).show();
        } else {
            // Sign in failed
            if (response == null) {
                // User pressed back button
                Log.e("Login","Login canceled by User");
            if (response.getErrorCode() == ErrorCodes.NO_NETWORK) {
                Log.e("Login","No Internet Connection");
            if (response.getErrorCode() == ErrorCodes.UNKNOWN_ERROR) {
                Log.e("Login","Unknown Error");
        Log.e("Login","Unknown sign in response");
  • Replace Digit button in your activity(If you have) with Standard button and have this code on button click.
                                new AuthUI.IdpConfig.Builder(AuthUI.PHONE_VERIFICATION_PROVIDER).build()

2.4 Run the app. Done!!

If you see any error regarding App validation failed due to SHA-1 certificate while running app. Please add SHA-1 Fingerprint. To add it click on Gear icon besides overview(top-left side) in firebase console → Project setting → Scroll down → Add Fingerpint

Few advantages of using Firebase phone authentication –

  • A fully customizable design and UI.
  • Direct access to the client API.
  • (Digits by Twitter) is being removed from the SMS message. Only your app’s name will be present.
  • There is no longer a separate agreement to the Digits Terms of Service for your users.

Note: Process of migration will not affect your app or your app’s users in any way

You can find sample project here…

Thanks for reading this article. Please recommend this article if you found it helpful.

Pinkesh Darji
I love to solve problems using technology that improves user’s life on a major scale. Over the last several years, I have been developing and leading various mobile apps in different areas. More than just programming, I love to write technical articles. I have written many high-quality technical articles. I have worked with various startups to build their dream app. I have been involved in product development since my early days and know insights into it. I have provided my valuable input while taking some crucial decisions of the app by brainstorming with a design, QA team. Over the last 3 years, I have been developing mobile apps and libraries using Google’s Flutter framework. I mentor junior Flutter developers and review their code. You will also find me talking on various Flutter topics in local meetups.