xain
xain

Reputation: 13849

Copy sqlite database from device to PC

I have an android program that stores its information in a sqlite database. Will it be straighforward to copy that db file to a pc once the device is plugged via USB or should a special functionality be written in the program itself to dump the db contents to a file under the /sdcard directory ?

Thanks

Upvotes: 6

Views: 12454

Answers (2)

vuhoanghiep1993
vuhoanghiep1993

Reputation: 881

You can create a bat file and run it , it will create a folder name clonedb and pull all database to this

adb shell rm -rf /sdcard/clonedb
adb shell run-as <app package> cp -r /data/data/<app package>/databases/. /sdcard/clonedb
adb pull /sdcard/clonedb ./

Upvotes: 1

superfell
superfell

Reputation: 19040

You can use the adb pull command to read a file from the teathered device to your desktop, e.g. adb pull /data/data/com.foo.bar/databases/MyDatabase

Upvotes: 9

Related Questions