作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
如何使用 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/
我是一名优秀的程序员,十分优秀!