Can I use AccountManager to let users sign in with their Google account?

前端 未结 3 936
北恋
北恋 2021-02-02 15:49

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 s

相关标签:
3条回答
  • 2021-02-02 16:21

    Although it is a new development, Google Plus Sign-in introduced as part of Google Play Services can also be used. More info can be found at Android developers blog. See example implementation from Banjo app

    enter image description here

    There seems to be a big limitation - The user need to have Google+ app installed on the device to use this.

    enter image description here

    Also this is a pretty good blog if someone is interested in implementing the solution.

    0 讨论(0)
  • 2021-02-02 16:22

    @Soham gave you some very useful links but he didn't correct one major error:
    AccountManager is the entity that manages the accounts on your Android device - it has nothing to do with your google account! you can use google account and create a NEW account on your device using the AccountManager.

    The rest you can learn from the links Soham gave you.

    0 讨论(0)
  • 2021-02-02 16:32

    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:

    • This is an in-depth look into how you can authenticate based on the users Android credentials, has an example of how things work and how the UI should be: http://www.finalconcept.com.au/article/view/android-account-manager-step-by-step-2

    • This is an example of getting AccountManager to work with a Google service like Google Tasks: https://developers.google.com/google-apps/tasks/oauth-and-tasks-on-android

    The user has to confirm whether you can use his/her credentials to log into the google service

    • The last example is using the same concept for accessing the Google Picasa service: http://code.google.com/p/google-api-java-client/wiki/AndroidAccountManager

    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

    0 讨论(0)
提交回复
热议问题