I am working on android studio with firebase. I created login and signup activities. The user can also update there profile picture and display name. On retrieving the user profile, I am getting the displayname, email, provider, UID and profile picture.
In emulator image shows in the imageview but when running it on real device image doesnot appear.
I have also added setPersistanceEnabled(true) but it doesnot solve. I have pasted my code by which user profile is created and retrieved.
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());