I am assuming that there will only be one user per phone. After a user logs in with which the user's credentials are checked against my server, I want to store their login details so they don't have to login every time the application starts up and more importantly, for every HTTP request. Should I use SQLite or SharedPreferences for this?
Asked
Active
Viewed 811 times
2 Answers
1
Seeing as its only a username/password combo, setting up an entire database would be way overkill for this, so SharedPreferences should be fine for you.
However, keep in mind that none of these storage options are particularly secure, so make sure you encrypt them in some way.
Raghav Sood
- 81,899
- 22
- 187
- 195
1
Technically you shouldn't store plain username and password... your server should return you a hash of some sort.. maybe your session info or username and password hashed together.. store that on the phone, next time user wants to login, pass that to the server and server should authenticate with that info. It is just a security feature.
chuthan20
- 5,389
- 1
- 17
- 21