gpt4 book ai didi

android - 如何在 Android 中使用 GMail 地址获取 Google 用户 ID?

转载 作者:行者123 更新时间:2023-11-30 03:16:31 27 4
gpt4 key购买 nike

如何使用 Android 中的 GMail 地址获取类似于“1242343543557656”的 Google 用户 ID?
我已经搜索过这个并且只找到关于如何获取 gmail 地址和用户名的答案。
我想要的是谷歌提供给 gmail 地址的唯一 ID?

这些是我已经提到的一些链接。
- Accessing Google Account Id /username via Android
- How can I get the google username on Android?
- Get the Google ID used to download the application
- How to get the Android device's primary e-mail address

最佳答案

据我所知,您无法直接从 Android 获取 google 用户 ID。唯一的解决方案是对 GAE 进行经过身份验证的调用(即使用“User”参数的调用),然后从 User 对象中读取 id,然后将其返回给 Android 客户端。

我认为最简单的实现方式(因为您使用的是 GAE)是使用 google 端点,这大大简化了身份验证。进行该身份验证的说明和代码 are here .

然后在 User 对象(端点的第一个参数)上调用 getUserId() 并将其返回给调用者。

关于android - 如何在 Android 中使用 GMail 地址获取 Google 用户 ID?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19994610/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com