2 回答

TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超6個(gè)贊
由于您僅在 FirebaseAuth 中使用電子郵件登錄,因此當(dāng)您嘗試檢索用戶(hù)的照片網(wǎng)址時(shí)會(huì)出現(xiàn)問(wèn)題,因?yàn)槟J(rèn)情況下用戶(hù)沒(méi)有照片網(wǎng)址。因此,您可以做的是要求用戶(hù)設(shè)置照片并使用FirebaseAuth保存網(wǎng)址(以便以后可以檢索)。您可以使用下面的代碼為用戶(hù)保存照片 URL。
UserProfileChangeRequest userProfileChangeRequest = new UserProfileChangeRequest.Builder()
.setDisplayName("set new display name")
.setPhotoUri(uri)
.build();
FirebaseAuth.getInstance().getCurrentUser().updateProfile(userProfileChangeRequest);
設(shè)置照片網(wǎng)址后。嘗試獲取照片網(wǎng)址
FirebaseAuth.getInstance().getCurrentUser().getPhotoUrl();
希望這有幫助!

TA貢獻(xiàn)1810條經(jīng)驗(yàn) 獲得超4個(gè)贊
試試這個(gè)
private FirebaseAuth mAuth; private FirebaseUser mCurrentUser;
初始化它
mAuth = FirebaseAuth.getInstance(); mCurrentUser = mAuth.getCurrentUser();
在圖像視圖中使用畢加索加載照片網(wǎng)址
Picasso.get().load(mCurrentUser.getPhotoUrl()) .into(imageView);
添加回答
舉報(bào)