Android Tutorial | Firebase User Registration | Part 5
Android is a mobile operating system developed by Google, based on a modified version of the Linux kernel and other open source software and designed primarily for touchscreen mobile devices such as smartphones and tablets. In addition, Google has further developed Android TV for televisions, Android Auto for cars, and Android Wear for wrist watches, each with a specialized user interface. Variants of Android are also used on game consoles, digital cameras, PCs and other electronics. Android provides a rich application framework that allows you to build innovative apps and games for mobile devices in a Java language environment.
Source
Source 2
Useful Links
What Will I Learn?
Requirements
Android Studio (Download)
Basic knowledge of Java
Android Device (For run and test our app)
Difficulty
- Intermediate
Curriculum
Android Tutorial | Google Text Recognition API | Part 1
Android Tutorial | Firebase User Registration | Part 2
Android Tutorial | Firebase User Registration | Part 3
Android Tutorial | Firebase User Registration | Part 4
Tutorial Contents
In this tutorial, I will continue where we left off in the previous tutorial. In previous lessons we have prepared our register and login pages. We did our registration process with Firebase. For our login process, we wrote our "userLogin" function.
In our "userLogin" function we had our edit texts, e-mail and password control. Now, firstly we will do login process with Firebase on the "userLogin" function.
I will do a "Progress Dialog " definition first to show the login user screen when the login button is pressed.
Code:
import android.app.ProgressDialog;
ProgressDialog progressDialog;
progressDialog = new ProgressDialog(this);
Now I will define the message and display the progressDialog.
Code:
progressDialog.setMessage("Login user...");
progressDialog.show();
I will now define Firebase object. And I'll write the "getInstance" method on our "onCreate" method so that it can run when our app runs.
Code:
import com.google.firebase.auth.FirebaseAuth;
FirebaseAuth firebaseAuth;
firebaseAuth = FirebaseAuth.getInstance();
Now we have integrated FireBase to our login activity, we can do our login process. For this we will use FireBase's "signInWithEmailAndPassword" method.
Code:
firebaseAuth.signInWithEmailAndPassword(email,pass).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
progressDialog.dismiss();
}
});
Yes, I created our "signInWithEmailAndPassword" method with our email and pass inputs and created our onComplete listener.
And I did progressDialog dismiss. (Login user...)
Now I write if the task is successful, show login successful toast message else show login failed toast message.
Code:
if (task.isSuccessful()){
Toast.makeText(LoginActivity.this,"Login successfully", Toast.LENGTH_LONG).show();
}else{
Toast.makeText(LoginActivity.this,"Could not login. Please try again.", Toast.LENGTH_LONG).show();
}
So we have successfully completed our entry process. All you need to do open the profile page is to redirect the activity in the "task.isSuccessful" section.
We came to the end of our Part 5 tutorial. Thank you for your attention.
Posted on Utopian.io - Rewarding Open Source Contributors
indentaion of those code's are awesome.
Thanks
Your contribution cannot be approved because it does not follow the Utopian Rules.
You can contact us on Discord.
[utopian-moderator]
Your Post Has Been Featured on @Resteemable!
Feature any Steemit post using resteemit.com!
How It Works:
1. Take Any Steemit URL
2. Erase
https://
3. Type
re
Get Featured Instantly � Featured Posts are voted every 2.4hrs
Join the Curation Team Here | Vote Resteemable for Witness