【问题标题】:How to fetch email addresses of Google plus circles (Friends added in Google plus circles)如何获取 Google+ 圈子的电子邮件地址(在 Google+ 圈子中添加的朋友)
【发布时间】:2013-10-02 05:04:54
【问题描述】:

我可以使用 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(); 
            }
}

【问题讨论】:

  • 我已经获得了登录人的电子邮件地址,我想获取他(亲自登录的)朋友的电子邮件地址。这样我就可以发送电子邮件/邀请使用我的应用程序
  • @NoumanBhatti:你找到解决方案了吗?
  • 否 没有得到解决方案
  • 这个问题的任何解决方案伙计们..我也有。

标签: android google-plus


【解决方案1】:

您可能需要同时请求 Google+ 范围和 Contacts API 范围 (https://www.google.com/m8/feeds)。然后,您需要请求用户的联系人并找到带有Google+ profile URLs 的联系人,如下所示:

<gContact:website href='http://www.google.com/profiles/1234567890' rel='profile'/>

然后您会查看该联系人的电子邮件地址是否也存在作为兄弟元素。

【讨论】:

  • 感谢您的回复。但我不明白。你能详细说明你的答案吗?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多