ginatrapani/todo.txt-android — pull request #413 by chuckbjones (2013-07-27 09:28:21+00:00)
Title: Added upgrade handling logic for migrating data to internal storage. 

The logic is generic and based on the application version, so it can be used for other upgrade tasks in the future.

Fixes #148 and #143.

I took a conservative approach here to avoid data loss. The data in external storage is copied to internal storage, but not deleted, in case the user wants to keep it around or if the app screws up and we need to migrate again.

Speaking of migrating again, this can be tested repeatedly by logging out and force-killing the application. The upgrade handler is only run at startup, and it will only run tasks that it hasn't run before. Logging out clears the version code out of shared preferences so it will run all tasks at the next launch. It also deletes the data from internal storage. Force-killing the app ensures that the upgrade handler runs the next time you launch the app.