-2

In version 1 of App ,Some operation refresh interval set it to milliseconds and time is stored in shared preferences in milliseconds. Now in version 2 i have changed time to seconds. here how app preference value works.I mean app version 1 user set the time limit as 1000 milliseconds after app update from google play store app will take same preference value ?if yes then how to deal with this.

sri
  • 73
  • 1
  • 11
  • https://stackoverflow.com/questions/12637737/what-will-happen-to-the-sharedpreferences-on-update-an-android-app – Sreehari Apr 05 '18 at 12:15

1 Answers1

2

In your SharedPreferences, when you save a set of key-value pairs that is crucial for operation, such as user settings, and other stuff, always store the version of your application alongside the other values, so you can identify how every value was created. If you then want to read the file, you can detect an older version, and update the key-value pairs to the syntax of the new version.

Obviously you did not specify any version yet in the SharedPreferences, so what you do? You simply introduce a new value for VersionID, and if it is not present in the existing SharedPreferences, you know it was created by the very first version of your application.

PKlumpp
  • 4,913
  • 8
  • 36
  • 64