tags:

views:

39

answers:

3

Is it possible to preserve file-persisted data when upgrading an app? For example my app stores data under /data/data/mypkg/store. I would like the store directory to be preserved when user upgrades my app.

+3  A: 

Application data is not deleted when upgrading apps. It is only removed when they are uninstalled

smith324
Thanks. Good to know.
JackN
is there a way to simulate upgrade process in development? When I upload a new version of code to emulator, it appears that Eclipse uninstall/reinstall the app
zer0stimulus
A: 

One way is to add methods to backup and recover the data to SD card.

JackN
+3  A: 

Please refer to adb documents.

adb install [-l] [-r] [-s] - push this package file to the device and install it
                               ('-l' means forward-lock the app)
                               ('-r' means reinstall the app, keeping its data)
                               ('-s' means install on SD card instead of internal storage)
adb uninstall [-k] - remove this app package from the device
                               ('-k' means keep the data and cache directories)

Add '-r' when you reinstall.
Add '-k' when you uninstall.

Jett
I didn't even know about this. Is there a way to duplicate thees commands from the run button in eclipse?
Falmarri