I have some code that generates a "read me" dialog and does some initial directory creation on the sd card, which currently resides in the onCreate method... I would like to segregate this code and have it execute only once, at the apps first run.. and then after all subsequent upgrades. I've noticed that most apps on the market do this, yet have not figured out how to implement it in mine yet... any help would be appreciated.
What I do is this: I save the apps version in its preferences and compare if the version changed. If it did, I display a dialog with information on whatever's new in this version and write the current version to the preferences.
This way the dialog will only appear once after each upgrade.
Check this page for SharedPreferences:
http://developer.android.com/reference/android/content/SharedPreferences.html
And this is how to get the version name of your app:
http://android.hlidskialf.com/blog/code/android-get-version-name
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