我正在使用Firebase开发Android Studio。我创建了登录和注册活动。用户还可以在那里更新个人资料图片和显示名称。 在检索用户个人资料时,我得到了显示名,电子邮件,提供者,UID和个人资料图片。
在模拟器中,图像在imageview中显示,但是在真实环境中运行时 设备图像没有出现。
我还添加了setPersistanceEnabled(true),但不能解决。我粘贴了用于创建和检索用户个人资料的代码。
private void updateProfile(String uName, Uri uri) {
UserProfileChangeRequest userProfileChangeRequest = new
UserProfileChangeRequest.Builder()
.setDisplayName(uName)
.setPhotoUri(uri)
.build();
user.updateProfile(userProfileChangeRequest);
mRef.child("Name").setValue(uName);
mRef.child(uri.getLastPathSegment()).setValue(uri.toString());
StorageReference profileStorage =
mStorage.child(uri.getLastPathSegment());
profileStorage.putFile(uri);
showMessage("Upload Successful");
Intent intent = new Intent(this,UserHome.class);
startActivity(intent);
}else{
showMessage("Upload Profile Picture");
}
}
////// for retrieving and displaying ///////
String namee = user.getDisplayName();
Uri uri = mAuth.getCurrentUser().getPhotoUrl();
Glide.with(UserHome.this).load(uri).into(imageView);
textView.setText(user.getDisplayName());
Log.v("data",user.getPhotoUrl().toString());