Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sqlite Database deleted when I clear data from Application

I have created Sqlite database in app. when I clear data from settings->applications->manage applications the Sqlite db removed. any suggestions to keep sqlite database as it is.

like image 622
PSK Avatar asked May 10 '13 06:05

PSK


People also ask

Does SQLite persist data?

Sqlite Database commonly used to persist the data in most Android applications. Sqlite file is created in your package folder. Sqlite data is persisted after application close and even phone switch off.

WHERE SQLite data is stored?

The Android SDK provides dedicated APIs that allow developers to use SQLite databases in their applications. The SQLite files are generally stored on the internal storage under /data/data/<packageName>/databases.

What does VACUUM do SQLite?

The VACUUM command works by copying the contents of the database into a temporary database file and then overwriting the original with the contents of the temporary file. When overwriting the original, a rollback journal or write-ahead log WAL file is used just as it would be for any other database transaction.


1 Answers

When you press Clear Data from the Android application manager its supposed to remove everything related to the app such as preferences, databases, caches etc the only thing that gets left is the app so when you re-launch it behaves as if it was just installed.

If you want to allow the user to clear the data but keep the database then there should be an option in the menu that removes the shared preferences but doesn't do anything with the database.

Hope this helps.

like image 90
Boardy Avatar answered Oct 21 '22 03:10

Boardy