Monday 25 November 2013

View the Android App database contents

So you created your Android App with SQLite database, and you are interested to view the database offline. You can do it with the adb command.

1) in command line, issue "adb shell" command, and then you will go to android prompt:
root@android:/ #

2) cd data/data, then ls, and you will see a lot of the App package:
com.android.bluetooth
com.android.browser
com.android.calculator2
com.android.calendar
com.android.certinstaller
com.android.contacts
com.android.defcontainer
....

3) cd  to your App package, say for example "com.victor.example"

4) cd databases, and ls to find out the databases name

5) run the command "sqlite3 mydb.s3db"
root@android:/data/data/com.victor.example/databases # sqlite3 mydb.s3db
sqlite3 mydb.s3db
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"

6) check the table name
sqlite> .tables
.tables
android_metadata  employees
sqlite> select * from employees;
select * from employees;
1|mitt|01234567|01234567|20
2|mitt|01234567|01234567|20
3|mitt|01234567|01234567|20
4|mitt|01234567|01234567|20
5|mitt|01234567|01234567|20
sqlite>

7) That's it. You successfully view the App database content using the adb shell command.

No comments:

Post a Comment