I have an admin user who can create a new account to other user. I wrote this code. It did work for first time, then it didn't work. I think it's because of user_ID it will be the same. If it's for this reason, how can I create new account even when I'm logged in?
My code:
mAuth.createUserWithEmailAndPassword(email,password)
.addOnCompleteListener(
add_accountActivity.this,
new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (!task.isSuccessful()){
}else{
String user_id = mAuth.getCurrentUser().getUid();
// add user Id to database
DatabaseReference current_user_db
=FirebaseDatabase.getInstance().getReference()
.child("account").child(user_id);
current_user_db.setValue(true);
}