My app stores simple settings in SharedPreferences
it works fine.
However for one person who's downloaded my app is having problems.
The settings in the SharedPreferences
are getting lost between closing and reloading the app.
Could he have a permissions problem somewhere on his phone that's preventing the data from being saved between sessions?
Has anyone experienced this or know of any reason why this could be happening? I'm having a pretty hard time debugging it, I don't know where to start.
// I'm using SharedPreferences Like so:
prefs = getSharedPreferences(this.getString(R.string.prefs_name), 0);
SharedPreferences.Editor editor = prefs.edit();
editor.putString("accounts", accounts);
editor.commit();
//retrieving stored information like:
SharedPreferences prefs = getSharedPreferences(this.getString(R.string.prefs_name), 0);
String accounts = prefs.getString("accounts","[]");
We are experienced same problems with our Android apps. Our userbase is pretty big (several million users) and by our statistics subjected problems occured for about 0,2% - 0,3% of users. It seems to be not so much, but with our userbase it thousands of users.
After long search for fixes of this problem, we've made a decision to stop using SharedPreferences
for our projects. We are using simple SQLiteDatabase
instead, and it works very well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With