Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where does Android store SQLite's database version?

I am unable to find where Android stores the database version within the SQLite database file. Where exactly is the database version stored?

like image 857
bhups Avatar asked Sep 14 '10 09:09

bhups


People also ask

Where is the database stored on an android device?

Android stores the file in the /data/data/packagename/databases/ directory. You can use the adb command or the File Explorer view in Eclipse ( Window > Show View > Other... > Android > File Explorer ) to view, move, or delete it.

How does SQLite store data on android?

This example demonstrates How to save data using sqlite in android. Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project. Step 2 − Add the following code to res/layout/activity_main. xml.


1 Answers

You can read the version using android.database.sqlite.SQLiteDatabase.getVersion().

Internally, this method executes the SQL statement "PRAGMA user_version". I got that from the Android source code.

In the database file, the version is stored at byte offset 60 in the database header of the database file, in the field 'user cookie'.

like image 186
Thomas Mueller Avatar answered Oct 12 '22 11:10

Thomas Mueller