3

Is it possible for an Android app's savedInstanceState to be persisted across an app update?

Take the following situation for example:

  1. I have a Parcelable model that gets written in onSaveInstanceState
  2. App updates, the structure of that Parcelable model changes in the new version
  3. App crashes on next open because the saved state of the Parcelable does not match the new model

I should think (hope) this could never happen, as it doesn't make any sense. Just want to be sure this is entirely impossible (as I can't seem to find any documentation that explicitly describes this situation).

Tspoon
  • 3,670
  • 1
  • 26
  • 33
  • It's a good question, too bad no one answered it. – George Aug 26 '15 at 23:21
  • API 21 added the ability for apps to use `onSaveInstanceState(Bundle b, PersistableBundle pb)` to persist state across reboot (with `onCreate(…)` and `onRestoreInstanceState(…)` counterparts. I'd try filling the `PersistableBundle` and update the app via adb while in the background (so instance state is saved) without launching any activity and then try getting back in the app via overview (aka. recents) to see if it's saved – Louis CAD Jul 13 '16 at 08:39

0 Answers0