How to Implement Firebase Mobile Authantication in Android App


project zip- CLICKME


          what is firebase Auth?
Almost every app collects data of the user to give them access to use their app.there
are several reasons to collect data and creating user account one of the main reason to differentiate them and to give them access to what data they use they can save it.
so almost every have had different types of login. Some common examples of login are
login with facebook,loginwithG+, email login, signup with email, twitter login. So there are many auth providers in Android.
Firebase Auth is an Auth provider API by which you can set authentication in Android App by various Auth provides like facebook, twitter, G+, Gmail, email, GitHub.

process-
In this blog, I have described every process and provided a set of codes so that you can easily implement Mobile Authentication in Your Android Application Follow the below steps to make authentication.If you have a problem you can also follow my Youtube Video to see the process

STEP-1

Make a new Android Studio Project




STEP-2

Make a new Activity Name it as  - PhoneAuthActivity




STEP-3

Add Your App with Firebase-Auth by going tools>firebase>Authantication then
Sign in if not and make a new project or choose an existing one
1.connect your app with firebase 
2. Add firebase authentication to your app




STPT-4

open a browser and go on- https://firebase.google.com/
Sign in and go to console of that project go on Authantication>SignInMethord
make sure that Phone SignIn is enabled





STEP-5



Change Intent Filter from MainActivity to  PhoneAuthActivity in Manifest file
Code After change-





STEP-6

Copy below code to  activity_phone_auth.xml





Step-7


Copy this code to PhoneAuthActivity.java except for the first line because of its package name.








STEP-8


IF WE want logout in MainActitity


then use these code in activity_main.xml 







MainActivity.java(copy except the first line )













hopes this blog will helpful for you and you are able to implement
Mobile Authantication in android without heaving any Knowledge of
Android Application.
If you want to understand this deeply how its working you can see
 firebase documentation.


Post a Comment

16 Comments

  1. Hi
    Please after running the code i had this error

    "Error: Activity class {com.example.alawatrik.transchat/com.example.alawatrik.transchat.MainActivity} does not exist.

    Error while Launching activity"

    Can you please help me solve it?

    ReplyDelete
    Replies
    1. please send me screenshot or zip file of codes i will fix that.

      Delete
    2. I have been able to debug it
      thank you very much. It works

      Delete
    3. keep supporting and suscribe our youtube channel
      https://www.youtube.com/channel/UClqsUUvOzIxkaN7DQsucffA

      Delete
    4. I have done that
      Thank you

      Delete
  2. hello sir even me i have some error inside

    ReplyDelete
    Replies
    1. please mention error or provide zip of your codes

      Delete
    2. https://drive.google.com/open?id=1VAZd8U0JA-bm-WjFK2e4DftGBjQNIaT9

      Delete
    3. App Level gradle build-



      apply plugin: 'com.android.application'

      android {
      compileSdkVersion 26
      buildToolsVersion "26.0.2"
      defaultConfig {
      applicationId "com.example.bhargav.samp"
      minSdkVersion 16
      targetSdkVersion 26
      versionCode 1
      versionName "1.0"
      testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
      }
      buildTypes {
      release {
      minifyEnabled false
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
      }
      }
      }

      dependencies {
      compile fileTree(dir: 'libs', include: ['*.jar'])
      androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
      exclude group: 'com.android.support', module: 'support-annotations'
      })
      compile 'com.android.support:appcompat-v7:25.3.1'
      compile 'com.android.support.constraint:constraint-layout:1.0.2'
      compile 'com.google.firebase:firebase-auth:11.8.0'
      compile 'com.firebaseui:firebase-ui:2.0.1'
      compile 'com.firebaseui:firebase-ui-auth:2.0.1'
      compile 'com.google.firebase:firebase-messaging:11.8.0'
      testCompile 'junit:junit:4.12'

      compile 'com.google.firebase:firebase-core:11.8.0'

      }

      apply plugin: 'com.google.gms.google-services'

      Delete
  3. The truth of the matter is that with regards to gaming, by and large a diversion is significant for its plot and activity, as well as the amusement's characters also. imessage from pc

    ReplyDelete
  4. It is truly a great and helpful piece of info,Excellent blog,Thanks for sharing. Castle Crush Apk Latest Version

    ReplyDelete
  5. thank you ,
    when i put the number i can't get the code verification
    can you help me please

    ReplyDelete
  6. Noting happened when i click on start.

    ReplyDelete
  7. Are you searching the right partner for Mobile App Development Services? Augurs is a leading enterprise mobile application development company that offers enterprise-grade mobile application development solutions in India.


    ReplyDelete
  8. Thanks for sharing this useful article. Are you searching the correct partner for Mobile App Development Services? Try this company Mobile App Development service

    ReplyDelete