1

I want to execute some code when android app is upgraded.

I read one way is to store the version info in shared preference/db and then compare on application onCreate and execute your logic. Does onCreate in Application run on upgrading? Android: How to reset FirstRun SharedPreferences when my app is updated?

But since the post dates back to 2013. Was just wondering if any new better ways have emerged out .

cheers, Saurav

Community
  • 1
  • 1
saurav
  • 5,388
  • 10
  • 56
  • 101
  • possible duplicate of [Android: How to reset FirstRun SharedPreferences when my app is updated?](http://stackoverflow.com/questions/4726283/android-how-to-reset-firstrun-sharedpreferences-when-my-app-is-updated) – njzk2 Aug 04 '14 at 14:37
  • well, mostly what is needed on to be executed on update is DB related, if this is your case, you can use onUpgrade() at your sqliteHelper, its fired when oldVersion!=newVersion (db version number) once everytime you change the db version number (automatically handled too) – Yazan Aug 04 '14 at 14:47
  • thanks @Yazan for the reply...well i have some application/ui specific thing to execute – saurav Aug 04 '14 at 15:07
  • @njzk2 i have gone through the link as i mentioned in my questioned...but was looking for some other ways – saurav Aug 04 '14 at 15:08

0 Answers0