我可以使用的AccountManager让用户登录他们的谷歌帐户? [英] Can I use AccountManager to let users sign in with their Google account?

查看:1418
本文介绍了我可以使用的AccountManager让用户登录他们的谷歌帐户?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个应用程序需要用户创建一个帐户。 (像Facebook或Twitter将要求您。)

但是,因为它是一个Android应用程序,应/可我让他们登录使用的AccountManager或其他服务的谷歌帐户?这将会是非常有益的,如果他们可能只是登录到自己的谷歌帐户,其设置和其他选项将被保存到该帐户。

主要问题,概括起来:

  1. 是否有可能让用户只需要使用自己的谷歌账户在我的应用程序?
    • 如果是这样,我用的AccountManager让他们登录并保存账户信息/设置?
      • 什么其他选择吗?
解决方案

是的,你可以得到用户登录到自己的谷歌服务使用他们的谷歌凭据,比如,我对谷歌任务的应用程序,我使用Android的AccountManager为了让用户使用Android设备上的谷歌帐户验证自己的身份(无需用户输入自己的密码!)

有一些让你开始真正的好例子:

  • 这是一个在深入探讨如何可以根据用户的Andr​​oid凭据验证,有是如何工作和UI应该如何的例子:<一href="http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-2">http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-2

  • 这是得到的AccountManager与谷歌的服务,如谷歌的任务工作的范例:<一href="https://developers.google.com/google-apps/tasks/oauth-and-tasks-on-android">https://developers.google.com/google-apps/tasks/oauth-and-tasks-on-android

  • 使用相同的概念用于访问谷歌的Picasa服务的最后一个示例:<一href="http://$c$c.google.com/p/google-api-java-client/wiki/AndroidAccountManager">http://$c$c.google.com/p/google-api-java-client/wiki/AndroidAccountManager

您有其他的选择就是让用户手动输入自己的用户名/密码。对于您必须使用第三方认证API(如路标获得的OAuth),为他们登录。

在我的任务/待办事项应用程序,我为用户提供两种选择登录,使用他们的Andr​​oid凭证或使用第三方认证适合希望登录使用其他帐户(这是不是在设备上启用帐户)的用户

让我知道,如果您有更多问题

I'm creating an app that will need users to create an account. (Like Facebook or Twitter would require you to.)

BUT, since it's an Android app, should/can I let them sign in with their Google Account using AccountManager or some other service? It'd be very helpful if they could just sign in to their Google account and their settings and other options would be saved to that account.

Main questions summed up:

  1. Is it possible to let a user just use their Google account in my app?
    • If so, do I use AccountManager to have them sign in and save account information/settings?
      • What are other options?

解决方案

Yes, you can get users to log into their Google Services using their Google credentials, for example, I have an app on Google Tasks and I use the Android AccountManager to let users authenticate themselves using their Google account on the android device (No need for users to enter their password!)

There are some really good examples to get you started:

The other options you have is to have users manually enter their username/password. For that you have to use a third party authentication API (like signpost for OAuth) for them to log in.

In my tasks/todo application I provide users both options to sign in, using their android credentials or using third party authentication for users that want to log in using some other account (an account which is not enabled on that device)

Let me know if you have more questions

这篇关于我可以使用的AccountManager让用户登录他们的谷歌帐户?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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