ingh.am
ingh.am

Reputation: 26752

Reading database file from android device

I've been trying to pull a copy of my sqlite database from my android app for dev. My first attempt was to call:

./adb shell
cd data/data
cd com.example.app
cd databases

But then I get stuck here as I do not have permission to do a pull or even view the files in that dir!

So I thought I'd try out the DDMS File Explorer which gives me this: File explorer

But when I try and pull files from here (I would expect them to be in the data folder) it just pulls the directory and nothing else. How can I do this to pull a copy of the database my app is creating/using?

I have tried this when the phone is on the SD card and on phone memory. I guess I could copy to SD card and then plug the SD card to pc rather than the phone and do it that way? Not sure if it would work and would be rather annoying to dev like that!

Thanks

Upvotes: 3

Views: 5491

Answers (2)

mah
mah

Reputation: 39807

If your device does not give you access to this directory (and your device is not rooted -- if you become root, you'll have access), you will need assistance from your application.

The application can, for example, copy databases/your_database_name.db to a readable location, perhaps on the SD card. Then you can pull from there.

Upvotes: 2

Ravi Vyas
Ravi Vyas

Reputation: 12375

IF you just need the DB for general checking/viewing you can run your app on the emulator and get the DB from there. If you need the specific instance on your device you need to root your device as others are suggesting.

Upvotes: 1

Related Questions