谷歌加号在Android [英] Google plus sign in on android

查看:78
本文介绍了谷歌加号在Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找网页几天,我完全糊涂了。我想补充的登录Google+的按钮,我的Andr​​oid应用程序。所有我的用户需要的是他的名字,电子邮件(如果可能)和ID。谷歌建议使用它的图书馆,但我相信,这是我的目的,沉重的解决方案。我知道我应该使用OAuth,但我不知道我应该用什么API。有人能指出我,我应该从哪里开始?

I've been searching web for a few days, and I am totally confused. I would like to add "Sign In with Google+" button to my android app. All I need from user is his name, email (if possible) and ID. Google suggests to use it's library, but I believe that it is to heavy solution for my purposes. I know that I should use OAuth, but I don't know what API I should use. Can someone point me where should I start?

推荐答案

其实我不建议使用谷歌自己的客户端,这是woudl GoogleAPIClient。

Actually I do recommend to use Google's own client, this woudl be GoogleAPIClient.

下面是为什么。
此客户端完全优化在Android上运行,它实际上不是那么重,因为它看起来并提供不只是你的客户端进行身份验证,以谷歌和处理连接所需的所有necesary接口,但也可以用来制作要求任何谷歌API服务。
使用第三方工具是好的,但我建议至少做认证与GoogleAPIClient,然后检索身份验证令牌,因此它可以在任何其他客户端使用。这最后一部分可以用GoogleAuthTool完成。

Here is the why. This client is fully optimize to run in Android, it is not actually as heavy as it looks and provide all necesary interfaces needed not just to authenticate your client to Google and handle connections, but can also be used to make request to any Google API service. Using third party tools is ok, but I recommend to do at least the authentication with the GoogleAPIClient and then retrieve the authentication token so it can be used in any other client. That last part can be done with GoogleAuthTool.

另一件事是文档,这在我看来,至少在部分认证为GoogleAPIClient Android是至少有据可查作出一个公平简单的例子,了解它是如何工作的。

Another thing is the documentation, it seems to me that at least for the authentication part GoogleAPIClient for android is well documented at least for making a fair simple example and understand how it works.

最后,为什么它有更好的表现?
在任何平台的第三方工具将最有可能使用谷歌API和库来完成认证,所以他们正在构建了它(如在红宝石谷歌的oauth2 omniauth扩展),因此,使用第三方工具是不完全变得更加轻量级

Finally, why does it have a better performance? Third party tools in any platform will most likely use Google APIs and libraries to complete authentication, so they are building over it(like the google oauth2 omniauth extension in ruby), so using third party tools isn't exactly becoming more "lightweight"

与Android进行身份验证的步骤是这里

The steps to authenticate with android are here

我希望这可以帮助,
最好

I hope this helps, best

这篇关于谷歌加号在Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆