【发布时间】:2019-02-07 08:51:24
【问题描述】:
我正在使用 firebase 开发 android studio。我创建了登录和注册活动。用户还可以在那里更新个人资料图片和显示名称。 在检索用户个人资料时,我得到了显示名称、电子邮件、提供商、UID 和个人资料图片。
在模拟器中图像显示在图像视图中,但在实际运行时 设备图像未出现。
我还添加了 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());
【问题讨论】:
-
您是否在 Firebase 控制台上提交了项目 sha 校验和?
-
我只记得,firebase 控制台中的 SDK 设置说,运行您的应用程序以验证安装,永远不会完成
-
我的应用程序已连接到 Firebase,但主要问题是图像根本没有显示在真实设备中。但是,在模拟器中,图像一旦上传就会显示,在模拟器中重新启动应用程序时,图像就会消失
标签: android firebase firebase-authentication