Skip to content

Instantly share code, notes, and snippets.

@nitesh-singh-1307
Created May 1, 2019 17:25
Show Gist options
  • Save nitesh-singh-1307/c7d69f8f60073406ae9fc133f2005e93 to your computer and use it in GitHub Desktop.
Save nitesh-singh-1307/c7d69f8f60073406ae9fc133f2005e93 to your computer and use it in GitHub Desktop.
log in with email id
mAuth.createUserWithEmailAndPassword("axy@gmail.com", "123456")
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d("CreateUser", "createUserWithEmail:success");
FirebaseUser user = mAuth.getCurrentUser();
updateUI(user);
} else {
// If sign in fails, display a message to the user.
Log.w("CreateUserWithemail", "createUserWithEmail:failure", task.getException());
Toast.makeText(MainActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
updateUI(null);
}
// ...
}
});
// create a method
private void updateUI(FirebaseUser user) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment