I am presently working on an WiFi application for Android. I am having trouble trying to access the database on the device. Debugging in the emulator doesn't work for me, because there is no WiFi support in the emulator. I tried pulling the database file out of the device by using
adb pull data/data/package-name/databases/database-name
I'll repeat myself from another answer:
Starting from API level 8 (Android 2.2), if you build the application as debuggable, you can use the shell
run-ascommand to run a command or executable as a specific user/application or just switch to the
UIDof your application so you can access its data directory.
So if you wish to pull your application database from the device you should run the application in the debug mode (to do so, simply run it from the Eclipse), connect with
adb -d shell and run the following commands:
run-as package-name cat /data/data/package-name/databases/database-name >/sdcard/database-name
This will copy
yourdatabase.db to the root of your SD card. Now you can easily get it from there (by using USB storage, adb pull or whatever else you like).
UPDATE @Shiki provided a convenient one-liner one can use without entering the adb shell:
adb -d shell 'run-as com.yourpackage cat /data/data/com.yourpackage/databases/dbname.sqlite > /sdcard/dbname.sqlite'