how to get info from user firebase android studio code example
Example 1: user login for android studio using firebase
auth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(this, OnCompleteListener{ task ->
if(task.isSuccessful){
Toast.makeText(this, "Successfully Registered", Toast.LENGTH_LONG).show()
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)
finish()
}else {
Toast.makeText(this, "Registration Failed", Toast.LENGTH_LONG).show()
}
})
Example 2: how to check the current user in firebase android
@Override
public void onStart() {
super.onStart();
FirebaseUser currentUser = mAuth.getCurrentUser();
if (currentUser == null) {
// No user is signed in
} else {
// User logged in
}
}