Search code examples
androidsqlitesecuritysharedpreferencesstore

Android - Security On Saving Data


I wanna save a user's score that is retrieved from a server, locally, in order to reduce number of calls to the server.
However if I use SharedPreferences, it could be easily edited by the user. If I use a local database, it could also be changed if user has root access. So is there any way to safely store data? Should I encode it?
Note that I can't check if local score equals server score, because it may be modified by the app.


Solution

  • A better way to enforce security while saving data in either to save it on your server and enforce security there. But, if you want it to be saved on local; then encrypt them and save them.

    It is not good to save sensitive data such as user's personal information and/or passwords in shared preferences or raw sqlite database without encryption.