Android Internal Storage when updating application
Asked Answered
E

2

14

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.

Elbaelbart answered 27/4, 2012 at 16:49 Comment(0)
L
9

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.

Leinster answered 27/4, 2012 at 16:51 Comment(5)
So, it's pretty safe to store files at the internal storage, right? (I don't use databases)Elbaelbart
Better to use database and what is the size of the fileLeinster
It actually depends on your needs. If you can tell us what you'll use internal storage for, then we may give a straight answer.Lynnelle
I actually use it to store some small txt files. So far it's working fine.Elbaelbart
Ok but better to use db. if you upgrade app then most of the time you need to uninstall the current app.Leinster
L
1

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)

Lynnelle answered 27/4, 2012 at 17:3 Comment(1)
Well I have already tested it but I asked just to be sure. I tested it with the emulator (changed the version code and name at the manifest) and the files are still stored when reinstalling the app (updating). I hope it will be the same with Android Market. And as you said, the docs don't say anything indeed.Elbaelbart

© 2022 - 2024 — McMap. All rights reserved.