How can I register a username in Firebase?

前端 未结 3 1241
醉话见心
醉话见心 2021-01-24 21:07

I am trying to implement the registration of a username in Firebase since it only gives me methods that are like the createUserWithEmailAndPassword(), but you can n

3条回答
  •  孤城傲影
    2021-01-24 21:25

    Try this,

    DatabaseReference database =   FirebaseDatabase.getInstance().getReference();
        User user = new User(firebaseUser.getUid(),
                firebaseUser.getEmail(),
                , firstName, photoURL); // add value as bean object
    
        database.child(ARG_USERS)
                .child(firebaseUser.getUid())
                .setValue(user)
                .addOnCompleteListener(new OnCompleteListener() {
                    @Override
                    public void onComplete(@NonNull Task task) {
                        if (task.isSuccessful()) {
                  // user data updated in firebase
                           }
    
    
                });
    

提交回复
热议问题