Firebase saves only email of the user. I want to save his/her name too.
How to achieve this?
Here's a bit of my code with which I'm creating and logging in the user:
public void loginByEmailMethod() {
//creating account
ref.createUser(email, password, new Firebase.ValueResultHandler<Map<String, Object>>() {
@Override
public void onSuccess(Map<String, Object> result) {
System.out.println("Successfully created user account with uid: " + result.get("uid"));
Toast.makeText(getBaseContext(), "Account successfully created!", Toast.LENGTH_LONG).show();
}
@Override
public void onError(FirebaseError firebaseError) {
// there was an error
Toast.makeText(getBaseContext(), "Account not created!", Toast.LENGTH_LONG).show();
}
});
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
//logging in the user
ref.authWithPassword(email, password, new Firebase.AuthResultHandler() {
@Override
public void onAuthenticated(AuthData authData) {
System.out.println("User ID: " + authData.getUid() + ", Provider: " + authData.getProvider());
Intent mainActivityIntent = new Intent(SignupScreenActivity.this, MainActivity.class);
startActivity(mainActivityIntent);
Toast.makeText(getBaseContext(), "User logged in successfully!", Toast.LENGTH_LONG).show();
}
@Override
public void onAuthenticationError(FirebaseError firebaseError) {
// there was an error
Toast.makeText(getBaseContext(), "User not logged in!", Toast.LENGTH_LONG).show();
progressDialog.dismiss();
}
});
}
}, 2000);
}
The problem is that with this method I can save only the email address of the user and not his/her name.
Please let me know how can I save name along with the email.
Thanks in advance.