ajay
ajay

Reputation: 1

How to get google account profile picture in android app

I am using firebase google sign in in my project. I want to display the account name, email and profile picture. I can display the name and email without any problem but I am not able to display the users google account profile picture. How do I do that?

Upvotes: 0

Views: 1343

Answers (1)

droid24
droid24

Reputation: 164

according to Docs

GoogleSignInAccount acct = GoogleSignIn.getLastSignedInAccount(getActivity());
if (acct != null) {
  String personName = acct.getDisplayName();
  String personEmail = acct.getEmail();
  Uri personPhoto = acct.getPhotoUrl(); // this line to get  profile picture 
}

then you can use Picasso Library to show images in ImageView

Picasso.with(this).load(personPhoto).into(R.id.imageview);

Upvotes: 4

Related Questions