我可以使用google plus登录并获取我的google plus圈子中所有人员的列表,但现在我也想获取圈子中所有人的电子邮件地址,有什么方法可以做到?我已经尝试过此代码,但是它不起作用。
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();
}
}
最佳答案
您可能需要同时请求Google+范围和Contacts API范围(https://www.google.com/m8/feeds
)。然后,您需要请求用户的联系人,并使用Google+ profile URLs查找联系人,如下所示:
<gContact:website href='http://www.google.com/profiles/1234567890' rel='profile'/>
然后,您将查看该联系人是否还存在作为同级元素的电子邮件地址。
关于android - 如何获取Google Plus圈子的电子邮件地址(在Google Plus圈子中添加的 friend ),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/19114453/