To view the database, you must first find the db file. If you copy the file to a computer, you can view it in many ways. on your mobile phone, you can use commands to view it directly and conveniently.
First, you need to find the database location. Generally, the database is stored in the private directory of the program, so you need to obtain the root permission.
Make sure that the development tool is connected to the mobile phone. Open the command line and enter adb shell.
At this time, the root permission is not obtained. Enter su and a prompt will be displayed on the mobile phone to allow the root permission to be obtained.
The suffix is changed to "#" and the root permission is obtained successfully. Then, you can enter the private directory of the application,
Enter cd data/package name/databases/to enter the database directory.
Below are some basic sqlite commands
First open the databaseInput sqlite3 test_db to open a data file named test_db.
To view the database structure,Input. schema
View All data
It seems a little difficult to see,To make the data look more beautiful, enter. head on to display the column name, enter. mode column, and display by class
It looks much more comfortable.
To view the number of tables, enter. table
View the structure of a single table. schema TableName
The above command should be enough to simply view the database.