Retrieving a user's public google/gmail picture

Is very easy

http://picasaweb.google.com/data/entry/api/user/<hereYourUserIdOrYourEmail>?alt=json

just has a little problem.

You only can get the picture of your Google+ profile, not directly from your gmail.

UPDATE:

This API is being deprecated and will be turned down in January 2019. Migrate to Google Photos Library API as soon as possible to avoid disruptions to your application.

More Info Here


UPDATE:

This API is being deprecated and will be turned down in January 2019. Migrate to Google Photos Library API as soon as possible to avoid disruptions to your application.

Info Here

Based on @jose920405 answer, I have written this free public API service called Pikmail API. Here some advantages.

  • No authentication needed.
  • It's totally free and open source.
  • It's written in Kotlin.
  • You don't need to write some wrapper for mapping the response.

Here is the blog post about how Pikmail API works internally.

Usage:

Html

<img src="https://pikmail.herokuapp.com/[email protected]?size=50" alt="Profile Picture">

Profile Picture

Java Android

Picasso.with(context).load("https://pikmail.herokuapp.com/[email protected]?size=50").into(imageView);

Feel free to contribute with you pull requests, open bugs or request new features here.

Note: This service is based on an independent library called Pikmail that can be used as a Gradle dependency in your java projects(servers or Android apps).


Google+ is the right way to do this. This actually has nothing to do with the Gmail API. You don't need a the user's userid, just a valid access token with appropriate scopes.

https://www.googleapis.com/plus/v1/people/me?access_token=YOUR_ACCESS_TOKEN_HERE

Unless there is an error/invalid token/etc, this will return a bunch of information about the user as JSON. Included in this data will be a URI for the user's profile image.

EDIT:

To get the profile picture for a user based on the email address, first search for the user

https://www.google.com/m8/feeds/contacts/default/thin?q=EMAIL_ADDRESS_HERE

You can then retrieve the correct userID for that user from the returned JSON, and use it to get a profile image.