Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see the contents of a sqlite db of my app in a real device?

Tags:

android

sqlite

I want to see the contents of my database created in my app in the device I deploied it. I can use sqlite commands in shell and see in emulator but not in a real device.

Can anyone know how to do it in real device?

like image 831
Bijesh Avatar asked Dec 26 '22 11:12

Bijesh


2 Answers

root is not necessary if the application is flagged a debuggable. You can use the run-as adb command.

e.g. to use sqlite :

adb shell "run-as com.your.package sqlite3 databases/database_name"

or copy and pull the database :

adb shell "run-as com.your.package cat databases/database_name > /sdcard/some_name"
adb pull /sdcard/some_name

unfortunately it seems that pre-ICS run-as has quite a few bugs, e.g. issue 20792 or 13965

like image 92
bwt Avatar answered Mar 03 '23 13:03

bwt


Actually your Real Device is not Rooted so you don't have a permission to access /data/data/<Application>/database/ directory.

Only one solution copy that file to external Storage .. And see it in SQLiteManager or any other SQLite tools.

like image 23
user370305 Avatar answered Mar 03 '23 13:03

user370305