Coders Packet

Authentication with Firebase in Android Studio using a Phone Number in Java

By Paras Saini

The project is for the development of an mobile phone SMS OTP based authentication android app using Java. In this project I use FirebaseUI for the authentication.

Screenshots of the app after successfully done with the Project:-


Phone Number based Authentication.Authentication with Firebase in Android Studio using phone number.



This project is for the development of OTP based authentication app using Java in android studio, in this project I have provided all required Java files like, etc. 

Firebase Authentication using Mobile Phone:-

For the development of this application I have used Firebase. First I have connected my app with firebase then I use firebase SMS OTP authentication system.You can use Firebase Authentication to sign in a user by sending an SMS message to the user's phone. The user signs in using a one-time code contained in the SMS message.

The easiest way to add phone number sign-in to your app is to use FirebaseUI, which includes a drop-in sign-in widget that implements sign-in flows for phone number sign-in, as well as password-based and federated sign-in.


1.Connect your android app with Firebse.

2. Enable Phone Number Sign-in for your Firebase Project.

3. Enable app verfication.

4.Send a verification code to user phone.

5. Create a PhoneAuthCredential Object.

Country Code Picker Library:-

I have also used Country Code Picker Library to provide different country mobile code according to the user requirements.

Country Code Picker (CCP)  is an android library which provides an easy way to search and select country or country phone code for the telephone number.

country code picker


Using this project you can develop your app for mobile authentication. 


To use this project you need to have proper knowledge of Android Studio and Firebase. As you know already Android Studio is used for the development of android apps and Firebase used for authentication and providing the other feature in the apps.

So you can use these Java files to develop your app and providing the facility of mobile-based authentication using mobile phone SMS OTP.

Files:- This Java file provide all source code used to set your app and connect your app with firebase using mobile  phone SMS OTP authentication. This Java file provides you the facility of country code picker, e.g, 91 for India.



Download Complete Code


No comments yet