I am unable to find where Android stores the database version within the SQLite database file. Where exactly is the database version stored?
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.
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.
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'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With