I’m writing a new version of my Android app and upon upgrade I need to perform a certain task. Is there anything similar to onUpgrade that is used for Sqlite but instead for the entire application?
If there is nothing similar, I assume I could store a flag in shared prefs saying the application has been upgraded but I would rather not have to run a check every time someone opens the application.
Thanks!
Unfortunately, no. The easiest way is to keep that flag in persistent memory, which can be checked during instantiation of the application object. If you’re interested in keeping upstart time as short as possible (who isn’t?), you can store the version in an ordinary file as an integer using DataOutputStream and DataInputStream. That way you’ll stay away from the overhead of parsing a SharedPrefs file.