android - How to prevent data on external storage getting deleted on reinstall/update? -


I have noticed that my app's data was removed during "ADB install-r" on external storage (such as SD card) goes. Although it is normal to uninstall (and then optionally alternate it to be notified), I do not understand why this is why to re-install (and thus for market updates as well). I could swear that this was not always the case.

I am especially using "access to files on external storage" on Android 2.2, but "save files that should be shared" or "save cache files". So I'm writing data in "/ sdcard / android / data // files / somefolder / data" stick to my preferences. @commonsware: The problem is not so much that I will get the Extensible File (IHHO) as I saw that my data is written, where I hope. It's not just stick I'm using a.o:

  public static file getDefaultDirectory (reference reference, string package name) {file directory; If (mActivity_getExternalFilesDir! = Null) {// API> = 8dir = invokeGetExternalFilesDir (reference, "luck"); } And if (mEnvironment_getExternalStorage directory! = Null) {// API & lt; = 7dir = invokeGetExternalStorage directory (); Dir = New File (dir.getPath () + "/ Android / data /" + packageName + "/ files /"); } And {// never return tap should ever be; } Return; There is a bug in IIRC, Android 2.2, which causes these symptoms;  

getExternalFilesDir () I recommend the use.


Comments