I am updating my Android app. The application retrieves data from my server, and among this data is the user ID. The user ID is a number (an integer), but it comes from the server as a string, for example, "1234". In the old version, I saved this user ID as a string in my general preferences, but now when I look back at it, I donβt like it and I want to save it as a whole, as it should be.
Still pretty simple. I just use putInt / getInt, not putString / getString. The problem is that all the people who are currently using the application will have the value stored in their general preferences as a string, and then when they update the application, the new version of the application will start trying to use getInt to get the value, which is the old version saved as a string.
What is the best way to avoid errors due to this and ensure the transition between the two versions of the application?
Thanks.
android sharedpreferences
365SplendidSuns
source share