user4152
user4152

Reputation: 241

Get the Google profile picture in Android

Is it possible currently to get the Google profile picture and paint it in an ImageView? I've been looking for posts that talk about this but I have not managed to find it.

Upvotes: 1

Views: 3194

Answers (2)

Alupotha
Alupotha

Reputation: 10093

geting google plus profile pic without using google api key

http://picasaweb.google.com/data/entry/api/user/any_name?alt=json

and after that you can grab img url in json and remove 's64-c' part from the url and append "?sz=100" parameter (100 or lager size)

http://lh6.ggpht.com/-gAabIEudGQw/AAAAAAAAAAI/AAAAAAAAAAA/n062zUtBx4k/s64-c/101417311204099987701.jpg

Upvotes: 3

L93
L93

Reputation: 788

I think what you need to do is authenticate and use one of the Google+ OAuth scopes (I think it would be plus.login), to get the profile picture url: https://developers.google.com/+/api/oauth#scopes

You can use the GoogleApiClient for this. Have a look into the documentation. Or take a look into the link in the comments of your question https://developer.android.com/reference/com/google/android/gms/common/api/GoogleApiClient.html

After that you can use a library like Picasso to load the image from the URL into the ImageView: http://square.github.io/picasso/

Picasso.with(context).load(pictureUrl).into(imageView);

Upvotes: 0

Related Questions