6

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

xain
  • 13,159
  • 17
  • 75
  • 119
  • Maybe this answer helps: http://stackoverflow.com/questions/6928849/debugging-sqlite-database-on-the-device – Reinhold Jan 03 '13 at 08:05
  • Possible duplicate of [Android - Pulling SQlite database android device](http://stackoverflow.com/questions/9997976/android-pulling-sqlite-database-android-device) – Amir Ali Akbari Jul 05 '16 at 11:12

2 Answers2

9

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

superfell
  • 18,780
  • 4
  • 59
  • 81
1

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 ./
vuhoanghiep1993
  • 715
  • 1
  • 8
  • 15