Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to register users with Google Account on android app

So, I'm creating an android app, and along with my standard registration method, I'd like to allow users to register using their Google account. I've seen a lot of information on "Log in with Google+" as well as OAuth implementations. However, I still haven't seen anything that really touches on just authenticating a user and allowing them to register for an application using their Google account, and then later log in using the same account, referencing my local copy of the user account record in my database. Essentially, what I want to do is:

  • Allow user to register an account using their Google account, which I assume would pull basic information such as name and email address, which I could use to create a local db record
  • When the user registers with their Google account, tie that registration or token id to the actual record in my database. Something that allows me to identify that user/record with a Google Account
  • When that user decides to login with Google, search for an existing association (access/token id) and log them in with that information (assuming it's still valid) and at the same time pull their local account information (for example, submitted reviews for a movie review application) that is tied to that Google Account.

I hope I've explained what I'm trying to accomplish, but if it still sounds a bit vague let me know and I'll try to explain more. Any help is greatly appreciated. I obviously don't expect anyone to code this for me, just to point me in the right direction, or just tell me that what I'm trying to do is a horrible idea. Either way, thanks in advance!

like image 543
Tim Avatar asked Oct 20 '22 07:10

Tim


1 Answers

You should start by reading some tutorials on how to achieve the registration.

https://developers.google.com/+/mobile/android/sign-in

and

https://developer.android.com/google/play-services/index.html

Maybe for the handling of the database you should use a content provider:

http://thinkandroid.wordpress.com/2010/01/13/writing-your-own-contentprovider/

or

http://www.vogella.com/tutorials/AndroidSQLite/article.html

the rest is just coding and some hard work. Hope i addressed you problem.

like image 94
JoaoFilipeClementeMartins Avatar answered Oct 23 '22 01:10

JoaoFilipeClementeMartins