Android Internal Storage when updating application

2020-05-23 08:11发布

问题:

I use the internal storage (http://developer.android.com/guide/topics/data/data-storage.html#filesInternal) to store some necessary application files, that the user creates.

I suppose that these files are stored forever right? They are removed only when the user uninstalls the application, am I correct?

In case of updating the application (for example from version 1.0 to 1.1) through the Android Market, then what will happen to the files that were stored from the previous version? Are they deleted or not?

Thank you in advance.

回答1:

In case of updating the application (for example from version 1.0 to 1.1) through the Android Market, the files that were stored from the previous version will be there on the device and if you uninstall the app to get the new version then the files will be deleted.



回答2:

Good question - the docs actually don't say anything about any of the persistence solutions retaining their data on upgrade. But just as SharedPreferences and Sqlite database, I suppose it would also persist during application upgrade. The best way to be sure is to test it yourself, though. (I know it may sound rude, as I'm like telling you to "see for yourself". But I won't mind doing it for you if my current machine is set up for android development)