How to keep the session of user login?

Posted by YaW on Stack Overflow See other posts from Stack Overflow or by YaW
Published on 2010-04-09T14:55:38Z Indexed on 2010/04/09 15:13 UTC
Read the original article Hit count: 340

Filed under:
|
|
|

Hi,

I have an app that requires user to register. I've got the app conected to PHP in my server to do the logic of register/login and so, this is not problem at all.

But, I want to keep a session of the user in local, so the user doesn't have to login again every time he runs the app.

So, I want something like this:

  • First time user, he opens the app, register and login.
  • Do some stuff with the app and closes it.
  • Open the app again, the user is recognized so he doesn't need to login again.

I only need to store an ID and a Username (both fetched from the DB in the login php method). What's the best way to do this??

I've thought about doing a custom preference, store the data in files or even a local DB (sqlite). Any suggestions?

© Stack Overflow or respective owner

Related posts about android

Related posts about java