Skip to content

Instantly share code, notes, and snippets.

@abhinavraj23
Last active September 28, 2019 19:38
Show Gist options
  • Select an option

  • Save abhinavraj23/690f493e0b1f0da18ee44b46e322dabe to your computer and use it in GitHub Desktop.

Select an option

Save abhinavraj23/690f493e0b1f0da18ee44b46e322dabe to your computer and use it in GitHub Desktop.
mAuth.createUserWithEmailAndPassword(email, password)
.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(TAG, "createUserWithEmail:success");
FirebaseUser user = mAuth.getCurrentUser();
updateUI(user);
} else {
// If sign in fails, display a message to the user.
Log.w(TAG, "createUserWithEmail:failure", task.getException());
Toast.makeText(EmailPasswordActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
updateUI(null);
}
// ...
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment