Get high quality profile picture from GoogleSignInAccount

In my Android app for authentication through google account I follow this official tutorial https://developers.google.com/identity/sign-in/android/people#retrieve_profile_information_for_a_signed-in_user and it works.

As indicated there, to get the profile picture, I use the getPhotoUrl () method of the GoogleSignInAccount class. Example:

GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
GoogleSignInAccount acct = result.getSignInAccount();
String personName = acct.getDisplayName();
String personEmail = acct.getEmail();
String personId = acct.getId();
Uri personPhoto = acct.getPhotoUrl();

Problem lies in the fact that the image that I get through this URL is of very poor quality (small size).

Screenshot example

How can I fix this problem?

+4
2

URL- sz=50 ( 50 - ). . sz=240

, URL- sz, Person API, sz getUrl(), , .

: Person.Image - doc, ,

URL- . , ? Sz = x, x -


, @stackpic91, API GoogleSignInAccount.getPhotoUrl() S96-c, , S240-c

+9

(Glide/Picasso), URL:

avatarUrl.replace("s96-c", "s192-c", true)

avatarUrl.replace("s96-c", "s384-c", true)

+1

All Articles