Android signup with Firebase working but addition information doesn't save to real time database. I am try to signup user with Firebase. I have done every as the docs told me to do and everything seems fine. The problem is the users get register but the additional information of the users don't save in the real time database and no error or log is show. //user information
User user;
if (whichUser == "Student") {
user = new User(userName, userContact, "student");
} else {
user = new User(userName, userContact, "hostelers");
}
//signup with email and password
mAuth.createUserWithEmailAndPassword(userEmail, userPassword)
.addOnCompleteListener(task -> {
if (task.isSuccessful()) {
//save the user infromation to db
FirebaseDatabase.getInstance().getReference("Users")
.child(mAuth.getCurrentUser().getUid())
.setValue(user)
.addOnCompleteListener(task1 -> {
if (task1.isSuccessful()) {
mDialog.dismiss();
register.setVisibility(View.VISIBLE);
Toast.makeText(this, "User registered", Toast.LENGTH_LONG).show();
} else {
mDialog.dismiss();
register.setVisibility(View.VISIBLE);
Toast.makeText(this, "" + task1.getException().getLocalizedMessage(), Toast.LENGTH_LONG).show();
}
});
} else {
mDialog.dismiss();
register.setVisibility(View.VISIBLE);
Toast.makeText(this, "" + task.getException().getLocalizedMessage(), Toast.LENGTH_LONG).show();
}
});
});
[Null Database the addition information is not saved][1]
[The user is registered][2]
[Firebase dependency][3]
[Sign up implementation][4]
[1]: https://i.stack.imgur.com/ImEhp.png
[2]: https://i.stack.imgur.com/Cy3MB.png
[3]: https://i.stack.imgur.com/zDetk.png
[4]: https://i.stack.imgur.com/X1WTf.png