Ank*_*94a 5 android google-contacts-api android-contacts google-people
在尝试使用用户的Google帐户获取联系人时,我在使用人员API后面临一些问题.它只返回所有列出的几个电子邮件地址.访问令牌和所有范围都已正确设置.以下代码:
People peopleService = new People.Builder(httpTransport, jsonFactory, credential)
.build();
ListConnectionsResponse response = peopleService.people().connections().list("people/me")
.setPageSize(500).setSortOrder("FIRST_NAME_ASCENDING")
.setAccessToken(tokenResponse.getAccessToken())
.setAlt("json")
.setRequestMaskIncludeField("person.names,person.emailAddresses,person.phoneNumbers")
. execute();
connections = response.getConnections();
Run Code Online (Sandbox Code Playgroud)
如果我使用谷歌的联系API,那么我将获得更多的电子邮件地址而不是人们.联系API的代码:
URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/default/full");
ContactFeed resultFeed = myService.getFeed(feedUrl, ContactFeed.class);
// Print the results
System.out.println(resultFeed.getTitle().getPlainText());
for (ContactEntry entry : resultFeed.getEntries()) {
....
.....
.......
}
Run Code Online (Sandbox Code Playgroud)
我想知道他们两者之间是否有任何差异,我必须使用哪一个以获得更好的结果,或者我错过了什么.请建议.谢谢..!!
People API 是最新的。通过阅读Google 的博客公告,People API 简化了对 Google+ API 和 Contacts API 的单独调用。现在您只需要使用一个。
\n\n\n\n\n\n\n“新的 People API 使用最新的协议和技术,\n 最终将取代使用 GData\n 协议的联系人 API”
\n
https://www.googleapis.com/auth/contacts- 请求为您的应用授予对经过身份验证的用户\xe2\x80\x99s Google 通讯录中的联系人的读写权限。\n https://www.googleapis.com/auth/contacts.readonly- 请求为您的应用授予对经过身份验证的用户\xe2\x80\ 中的联系人的读取权限x99s 谷歌通讯录。
检查此链接以了解People API 和 Contacts API 之间的相似点和差异。
\n| 归档时间: |
|
| 查看次数: |
1300 次 |
| 最近记录: |