I\'m new to Android programming and trying to wrap my head around this just to make myself clear about how things work.
When creating Sqlite databases in an Android
The DBs, Preferences, Cache Files, Temp Files all are stored in the location /data/data/app.package.name/ in Phone Memory.
When you uninstall your App, the whole Phone Memory folder for this app will be completely removed.
The database is located in /data/data/app.package.name/databases
. You can access this folder only on the emulator or on a rooted device (with a file explorer with a Super user right for example).
When you delete an app all the relative datas are deleted (databases included)
SQlite databases are just files, and they're treated like any other file: they're stored (by default) in the application's private data area (/data/data/$PACKAGENAME/databases
). They're deleted along with everything else in the application's private data area.
You can create a database on the SD card if you like. They, of course, won't be removed on uninstallation.
Unless stated otherwise (by you), apps keep their datas under /data/data/<appname>
, and SQLite-databases are in /data/data/<appname>/databases
. When uninstalling an app, the whole directory tree of /data/data/<appname>
will be deleted, including your databases.
Normally, the database would be stored in
/data/data/package.name.of.your.app/databases
However it's not a good thing to rely on this. It's much better to find it using getDatabasePath
on ContextWrapper
, such as:
File dbFile = getDatabasePath(db_name);
And, yes, normally the whole directory /data/data/package.name.of.your.app
would be deleted if you uninstall the app.