Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does uninstalling of an android app delete the database stored on sdcard?

I have a library app where I store each book as an SqliteDatabase. I save all the book dbs on sdcard. My question is if user uninstalls my app, then do all the dbs related to this app get deleted? If no, how can I achieve this?

Thanks.

like image 697
techno Avatar asked Aug 19 '11 05:08

techno


2 Answers

Generally No actually. When you uninstall, the APK itself (/data/app/com.example.app-1.apk) and the data (sharedprefs/db/etc) in /data/data/com.example.app is removed, but only Android >= 2.2 will also delete anything from the sdcard, and only a specific directory getExternalFilesDir() (/sdcard/Android/data/com.example.app usually).

However some earlier versions of Froyo will also delete when updating an app, which makes it rather dangerous to use for persistent storage.

like image 179
Kevin TeslaCoil Avatar answered Oct 21 '22 10:10

Kevin TeslaCoil


It depends. If you put your files on some arbitrary place on external storage (SD card), they will not be deleted after you uninstalled your app. If you used getExternalFilesDir() (Android 2.2+) to get the directory to store your files in, they will be deleted when the app is uninstalled. On some early versions of Froyo, there is apparently a bug that deletes the files even on app upgrades, so you might want to watch out for this.

like image 2
Nikolay Elenkov Avatar answered Oct 21 '22 11:10

Nikolay Elenkov