Applications use these classes to manage private databases. If creating a content provider, you will probably have to use these classes to create and manage your own database to store content. See Content Providers to learn the conventions for implementing a content provider. If you are working with data sent to you by a provider, you do not use these SQLite classes, but instead use the generic {@link android.database} classes.
The Android SDK and Android emulators both include the
sqlite3 command-line
database tool. On your development machine, run the tool from the
platform-tools/ folder of your SDK. On the emulator, run the tool
with adb shell, for example, adb -e shell sqlite3.
The version of SQLite depends on the version of Android. See the following table:
| Android API | SQLite Version |
|---|---|
| API 27 | 3.19 |
| API 26 | 3.18 |
| API 24 | 3.9 |
| API 21 | 3.8 |
| API 11 | 3.7 |
| API 8 | 3.6 |
| API 3 | 3.5 |
| API 1 | 3.4 |
Some device manufacturers include different versions of SQLite on their devices. There are two ways to programmatically determine the version number.
adb -e shell sqlite3 --version.
String query = "select sqlite_version() AS sqlite_version";
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(":memory:", null);
Cursor cursor = db.rawQuery(query, null);
String sqliteVersion = "";
if (cursor.moveToNext()) {
sqliteVersion = cursor.getString(0);
}