I am able to login with google plus and have fetch the list of all the people who are in my google plus circle but now i also want to get the email addresses of all people in my circle is there are way to do it? I have tried this code but it does not work.
public void onPeopleLoaded(ConnectionResult status, final PersonBuffer personBuffer,
String nextPageToken)
{
if (status.getErrorCode() == ConnectionResult.SUCCESS)
{
try
{
//Add all friends ids in an arraylist
int count = personBuffer.getCount();
//Loop through all the ids of google plus friends
for (int i = 0; i < count; i++)
{
//mListItems.add(personBuffer.get(i).getDisplayName());
//mListIds.add(personBuffer.get(i).getId());
friends_gplus_Ids += personBuffer.get(i).getId() + ",";
//Log.d("Emails", personBuffer.get(i).getOrganizations().toString());
//personBuffer.get(i).getEmails().size();
if((personBuffer.get(i).getEmails().size() > 0))
{
Log.d("Emails", personBuffer.get(i).getEmails().get(0).toString());
}
else
{
Log.d("Emails", "Null");
}
}
}
finally
{
personBuffer.close();
}
}
You would probably need to request both the Google+ scopes and the Contacts API scope (https://www.google.com/m8/feeds
). You would then need to request the user's contacts and find those with Google+ profile URLs, which will look something like:
<gContact:website href='http://www.google.com/profiles/1234567890' rel='profile'/>
Then you'd look to see if an email address also existed for that contact as a sibling element.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With