If I store some user settings and information in shared preferences in my android apps, and then I update the app in the Market, will those settings be erased when the app updates?
SharedPreferences is what Android and iOS apps use to store simple data in an allocated space. This data exists even when the app is shut down and starts up again; we can still retrieve the value as it was. The data stored in SharedPreferences can be edited and deleted.
The shared preference is definitely deleted when the application is uninstalled.
Shared preferences is an Android class that allows apps to store key-value pairs of primitive data types. Once saved, information in shared preferences will persist across sessions.
Android Shared Preferences Overview Android stores Shared Preferences settings as XML file in shared_prefs folder under DATA/data/{application package} directory. The DATA folder can be obtained by calling Environment.
No, the Shared Preferences will remain.
To make the answer simple: NO in normal circumstances.
The update process only replaces the apk file(and so what is in it for example drawables,...) and does not alter databases,sharedpreferences and any other files that generated in run time(probably in this case,new App is installed with the UID that is equal to UID of previous App).
But following this thread it seems that there are cases when data could be lost. Like changing Copy PROTECTION FROM ON to OFF OR OFF to ON.
Quoting the answer:
It turns out when we posted the update copy protection was turned off, but for our initial release it was turned on. Which caused all our shared preferences to get lost, we could no longer create private data files, and the game started randomly crashing.
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