android - Google+ Api - 在 android 中获取关联帐户

标签 android google-plus google-play-services

我正在使用新的 Google+ 登录 API。用户点击登录后,他们可以选择要使用的谷歌帐户,然后继续授权该应用程序。我怎样才能得到他们选择的帐户?

原因是我一直在为我的应用程序使用常规的 google 身份验证,并且用户帐户与电子邮件地址相关联。使用此 Google+,我不确定如何在不要求用户再次选择帐户的情况下获取帐户电子邮件。

最佳答案

您可以使用 PlusClient.loadPerson() method 检索用户的个人资料信息,如果他们选择公开,其中可以包括他们的电子邮件地址。至reliably get their email address ,您可以在请求 userinfo.email 范围后使用 PlusClient.getAccountName() 或使用 userinfo REST 端点。

文档中的代码示例遍历了上述每种情况。

关于android - Google+ Api - 在 android 中获取关联帐户,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15161611/

相关文章:

javascript - 角色 ="button"是什么意思?

android - 如何在 Edittext Android 中取消选中的文本?

google-plus - Google+ JavaScript API 是否与 Facebook 的 signed_request 等效?

android - 从服务中获取 View

javascript - 自定义Google+按钮回调

android - 发布时,显示支持 70 多种语言,但我的应用只有两种

google-play-services - 如何管理具有免费试用期的 Google Billing 订阅?

未安装 Google Play 服务的 Android Mobile Vision API 和 ML Kit

android - 如何在 SimpleCursorAdapter 中使用自定义字体在 Searchable Dictionary App 的 ListView 中?

java - 我的共享首选项无法正确共享