Peter Sun
Peter Sun

Reputation: 1813

Best way to save data in android

I am creating an chat program that communicates with my server at home, so I can send commands. I was wondering what is the best way to save the login information? database? shared preference? sqlite database? file(xml,txt)?

what do you guys think and why?

Upvotes: 0

Views: 930

Answers (2)

ᗩИᎠЯƎᗩ
ᗩИᎠЯƎᗩ

Reputation: 2132

Login information contains passwords also, so I would consider this security problem choosing the location to save data.

Login information is usually stored in the server and not in the client: I would definitely choose to store them in a DB.

I suggest to encrypt passwords if you want to save them in a DB (SQLite, MySql or whatever).

For further information I suggest to take a look here: Android: Storing username and password?

Upvotes: 0

amatellanes
amatellanes

Reputation: 3735

You can take a look at this article: http://developer.android.com/guide/topics/data/data-storage.html

In my opinion, the best way will depend on the amount of data, if you want to save your login information I'd use SharedPreferences, but if you want to save the login information of many people, I think of using a sqlite database.

Upvotes: 1

Related Questions