I currently started using Firebase for my Android application and I used the samples on their GitHub to create the login and register activity.
The only thing is that I noticed that their version only has an email and password for both login and registration. I would like to add a username field at the time of registration for my users. I did find some other links that might provide an answer but I know that Firebase was recently changed and those answers didn't show the same method of registration as the example so I figured it might be different. This is my createAccount code block:
public void createAccount(String email, String password) {
if (!validateForm()) {
return;
}
showProgressDialog();
mAuth.createUserWithEmailAndPassword(email, password).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()) {
Toast.makeText(LoginActivity.this, "An error occurred", Toast.LENGTH_SHORT).show();
}
hideProgressDialog();
}
)};
}
Aucun commentaire:
Enregistrer un commentaire