1<HTML>
2<BODY>
3Contains the SQLite database management
4classes that an application would use to manage its own private database.
5<p>
6Applications use these classes to manage private databases. If creating a
7content provider, you will probably have to use these classes to create and
8manage your own database to store content. See <a
9href="{@docRoot}guide/topics/providers/content-providers.html">Content Providers</a>
10to learn the conventions for implementing a content provider. If you are working
11with data sent to you by a provider, you do not use these SQLite classes, but
12instead use the generic {@link android.database} classes.
13
14<p>The Android SDK and Android emulators both include the
15<a href="{@docRoot}studio/command-line/sqlite3.html">sqlite3</a> command-line
16database tool. On your development machine, run the tool from the
17<code>platform-tools/</code> folder of your SDK. On the emulator, run the tool
18with adb shell, for example, <code>adb shell sqlite3</code>.
19
20<p>The version of SQLite depends on the version of Android. See the following table:
21<table style="width:auto;">
22  <tr><th>Android API</th><th>SQLite Version</th></tr>
23  <tr><td>API 34</td><td>3.39</td></tr>
24  <tr><td>API 33</td><td>3.32</td></tr>
25  <tr><td>API 32</td><td>3.32</td></tr>
26  <tr><td>API 31</td><td>3.32</td></tr>
27  <tr><td>API 30</td><td>3.28</td></tr>
28  <tr><td>API 28</td><td>3.22</td></tr>
29  <tr><td>API 27</td><td>3.19</td></tr>
30  <tr><td>API 26</td><td>3.18</td></tr>
31  <tr><td>API 24</td><td>3.9</td></tr>
32  <tr><td>API 21</td><td>3.8</td></tr>
33  <tr><td>API 11</td><td>3.7</td></tr>
34  <tr><td>API 8</td><td>3.6</td></tr>
35  <tr><td>API 3</td><td>3.5</td></tr>
36  <tr><td>API 1</td><td>3.4</td></tr>
37</table>
38
39<p>Some device manufacturers include different versions of SQLite on their devices.
40  There are two ways to programmatically determine the version number.
41
42<ul>
43  <li>If available, use the sqlite3 tool, for example:
44    <code>adb shell sqlite3 --version</code>.</li>
45  <li>Create and query an in-memory database as shown in the following code sample:
46    <pre>
47    String query = "select sqlite_version() AS sqlite_version";
48    SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(":memory:", null);
49    Cursor cursor = db.rawQuery(query, null);
50    String sqliteVersion = "";
51    try {
52        if (cursor.moveToNext()) {
53            sqliteVersion = cursor.getString(0);
54        }
55    } finally {
56        cursor.close();
57    }</pre>
58  </li>
59</ul>
60</BODY>
61</HTML>
62