我想向Firebase用户对象添加其他信息,例如
当用户注册createUserWithEmailAndPassword()
此方法时,如何在用户配置文件详细信息中添加额外信息
我的firebase版本是 - “firebase”:“^ 5.7.2”
我想这是不可能的。建议在Real Time Database或Firestore中手动存储其他详细信息。链接到类似的讨论。
Add Extra Details on Firebase User Table
谢谢,迪纳卡兰
实际上,您只能使用此方法添加用户名或照片URI:
UserProfileChangeRequest profileUpdates = new UserProfileChangeRequest.Builder()
.setDisplayName(username)
.setPhotoUri("uri")
.build();
user.updateProfile(profileUpdates)
.addOnCompleteListener(new OnCompleteListener<Void>() {
@Override
public void onComplete(@NonNull Task<Void> task) {
if (task.isSuccessful()) {
Toast.makeText(getApplicationContext(), "done",
Toast.LENGTH_LONG).show();
}
}
});