The scenario:
I am building an app that allows the user to sign in using their Google account, it's worth noting that this is done using Firebase authentication.
The problem:
The user signs in perfectly but whenever i get their profile picture it is returned fine but it's very blurry.
I've researched and found some sites mentioning to change the resolution of the Google profile image but I'm not sure if that's possible. I know Facebook has a graph that allows for you to manipulate the URL of the profile image to change the resolution but I'm not sure how to improve the resolution of the profile image via Google.
I've posted a screenshot of the blurry image below:
This is the XML code for the ImageView that I'm loading the profile image in:
<de.hdodenhof.circleimageview.CircleImageView
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/image_view_profile_pic"
android:layout_width="96dp"
android:layout_height="96dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="36dp"
android:src="@drawable/app_bar_tool_bar_bg"
app:civ_border_width="2dp"
app:civ_border_color="#FFFFFFFF"
android:contentDescription="@string/content_description_profile_picture" />
This is the code I used to get the profile image from Google via Firebase:
private void getUserProfileContent() {
// Check if the user is signed in
if (mUser != null) {
for (UserInfo profile : mUser.getProviderData()) {
// Profile photo url
Uri photoUrl = profile.getPhotoUrl();
// Load user's profile photo from their signed-in provider into the image view
Glide.with(ProfileActivity.this)
.load(photoUrl)
.into(mProfilePic);
}
}
}
This is the code to get the currently authenticated user:
// Variable declaration
private FirebaseUser mUser;
// Initializatioin in onCreate method
mUser = FirebaseAuth.getInstance().getCurrentUser();
Then of course, I call the above method in the onCreate method so it gets executed, like so:
getUserProfileContent();
I have read on this site that Google URLs can be manipulated to change the size of an image:
Details about Google's "magic" URL
Also, I've seen this site mentioning something similar about profile picture being blurry:
Firebase Google Group: Profile picture blurry
As it relates to the second link I haven't quite wrapped my head around how to carry out what they've suggested.