Android: can I save data when updating the application?

Can I save data while saving files when updating the application? For example, my application stores data in / data / data / mypkg / store. I would like the storage directory to be kept when updating my application.

+4
source share
3 answers

When updating applications, application data is not deleted. It is deleted only when they are deleted.

+7
source

Refer to adb docs.

adb install [-l] [-r] [-s] - click this package file on the device and install it
('- l' means forward blocking of the application)
('- r' means reinstalling the application, saving its data)
(n - s means installing on an SD card instead of internal storage)
adb uninstall [-k] - remove this application package from the device
('- k' means storing data directories and caches)

Add "-r" when reinstalling.
Add "-k" when uninstalling.

+4
source

One way is to add methods for backing up and restoring data to an SD card.

0
source

All Articles