Reputation: 123
I'm worried about android security. I am storing the user id in sharedpreferences. I see some programs online that allow you to get into the sharedpreferences if your device is rooted... etc...
How do I prevent my sharedpreferences from being changed?
Upvotes: 0
Views: 332
Reputation: 13335
There is no way to avoid a user being able to change shared prefs. You need to implement security on your back end with session tokens so that even if the front end userid is changed the back end doesn't allow you to make requests because the session token doesnt match the user id. I assume you are asking because you are having you app communicate with a server and dont want the user to be able to see other peoples data. if not may i ask why you need to be able to do this?
read more about them here Session token - how does it work?
Upvotes: 1
Reputation: 104
Code like this
SharedPreference mySP = PreferenceManager.gerDefaultSharedPreference(this, Context.MODE_PRIVATE);
Only your app can access this...
Upvotes: 0