1

I read something from forum. Someone has developed an android application. He used SharedPreference to store the passcode instead of SQLite.

I wish to know the reason. Is SharedPreference has higher security compared to SQLite?

I has googled about SharedPreference but not really understand about it.

Thanks for info.

user1939393
  • 91
  • 1
  • 5

3 Answers3

1

If you Google it well enough you get more information than is good to know. Seriously.

  1. Pros and Cons of each approach.
  2. Security related discussion.
  3. A basic difference.

And what's more? It's ALL on SO! Yay.

Community
  • 1
  • 1
varevarao
  • 2,186
  • 13
  • 26
0

Of course, I don't know the motivation of "someone" but I could imagine that it was just simpler to implement. It is certainly not more secure.

Henry
  • 42,982
  • 7
  • 68
  • 84
0

I use both and what my mentor told me when I asked him was its really a matter of personal preference. I use mysql and shared prefs as the equivalent of sessions in a android app + from what I can tell its the intended purpose of shared prefs and why store that kind of simple data in a mysqlite db if i dont have to? I only need to store a few fields of short data and ik that data isnt going to need to be edited. Mysqlite is kinda overkill in that situation imo, but here are some great examples of both uses :

Shared Prefs:

http://www.androidhive.info/2012/08/android-session-management-using-shared-preferences/

Login with mysqlite:

http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/

(note: if u dl the source from both the login example can easily be converted to use shared prefs. Almost all of the code on that site has been refactored into individual classes that can be reused over and over with very little to no editing.

Dont get me wrong, I do use mysqlite for caching the users profile/feed ect.. ,so they dont have to wait for it to load and eventually i might use all 3 (mysql, shared prefs and mysqlite) for my login. ( example: allow user to register for the first time-> query mysql, store data as shared prefs as a session, store user data in mysqlite so that after they register the user can be login and view existing cached messages and ect.. even w. out a internet connection by querying the mysqlite db instead and storing the returned values in shared prefs( i would of course validate these credentials with the server side as soon as they do get a signal/before i allow them to change or edit anything.

ChuckKelly
  • 1,742
  • 5
  • 25
  • 54