Migrate your Android App from Digits to Firebase

If you use Digits to sign in users with their phone numbers, you should migrate your app to Firebase Authentication. All future development of the phone number sign-in feature will happen in Firebase, and on September 30, 2017 Digits will be shut down.

By following the instructions on this page, you can migrate your app from Digits to Firebase, without disrupting your current Digits users.


To migrate your app from Digits to Firebase Authentication, complete these steps:

  1. Migrate your Digits user accounts to Firebase
  2. Replace the Digits SDK with the Firebase SDK
  3. Migrate active Digits sessions to Firebase

The first step can be completed immediately without affecting your app or existing users; the remaining steps should be completed at the same time.

Migrate your Digits user accounts to Firebase

First, migrate your Digits user accounts to Firebase as described in the Fabric developer docs.

After you complete the account migration steps, wait a few hours for your Digits user accounts to be moved to your Firebase project. When migration completes, you will have a Firebase project that contains all of your Digits user accounts. In addition, any Digits accounts created after enabling migration will be automatically migrated to Firebase.

Replace the Digits SDK with the Firebase SDK

Next, in your app, replace the calls to the Digits SDK with calls to the Firebase SDK.

To add phone number sign-in using Firebase Authentication to your app, do one of the following:

  • If you want a drop-in solution with UI, install FirebaseUI and replace the Activity that displays your DigitsAuthButton with the AuthUI Activity from FirebaseUI. for example:
                new AuthUI.IdpConfig.Builder(AuthUI.PHONE_VERIFICATION_PROVIDER).build(),
                // Other providers you want to support
                // ...
    This is the easiest way to add Firebase Authentication to your app.
  • If you don't want to use FirebaseUI, and prefer to build your own UI or integrate with an existing sign-in UI, set up the Firebase SDK to use phone number sign-in and make the following changes to your Digits code:

    • In your Activity's layout, replace the com.digits.sdk.android.DigitsAuthButton element with a standard Button or ImageButton element.
    • Replace the logic in AuthCallback with equivalent code in PhoneAuthProvider.OnVerificationStateChangedCallbacks.
    • In your phone sign-in button's onClick listener, replace the call to Digits.authenticate with a call to verifyPhoneNumber, as in the following example:
          phoneNumber,        // Phone number to verify
          60,                 // Timeout duration
          TimeUnit.SECONDS,   // Unit of timeout
          mCallbacks);        // OnVerificationStateChangedCallbacks

After you replace Digits with Firebase, remove the Digits SDK from your build.gradle file.

Migrate active Digits sessions to Firebase

Finally, migrate any active user sessions from Digits to Firebase so that your users do not have to sign in again after you deploy your updated app.

To migrate your Digits sessions to Firebase sessions, use the Digits Migration Helper SDK to generate a Firebase authentication token from the active Digits session. Then, use the token to sign in with Firebase. Finally, after successfully signing in using Firebase, clear the Digits session.

  1. Add the dependency for the Digits Migration Helper to your module-level build.gradle file:
    compile 'com.google.firebase:firebase-auth:11.8.0'
    compile 'com.firebase:digitsmigrationhelpers:0.1.1'
  2. Ensure that your AndroidManifest.xml contains your Fabric and Digits keys:
    <!--You may already have io.fabric.ApiKey entry. Continue using it -->
  3. In your Application's or main Activity's onCreate method, check for an active Digits session, and if one exists, convert it to a Firebase session by calling AuthMigrator.migrate. For example:
            new OnSuccessListener() {
                public void onSuccess(Void authResult) {
                    FirebaseUser u = FirebaseAuth.getInstance().getCurrentUser();
                    if (u != null) {
                        // Either a user was already logged in or token exchange succeeded
                        Log.d("MyApp", "Digits id preserved:" + u.getUid());
                        Log.d("MyApp", "Digits phone number preserved: " + u.getPhoneNumber());
                    } else {
                        // No tokens were found to exchange and no Firebase user logged in.
            new OnFailureListener() {
                public void onFailure(@NonNull Exception e) {
                    // Error migrating Digits token
    If the call completes successfully, the Digits session has been converted to a Firebase session, and the original Digits session has been deleted.
  4. Optional: Record that the Digits session has been migrated, and conditionally skip the previous step if it has already been completed.

Send feedback about...

Need help? Visit our support page.