Al Phaba
Al Phaba

Reputation: 6775

Is it possible to retrieve the database file of my android app on a non rooted device?

My device is not rooted and I want to check the content of the database of my developed app. How can I download this database to my desktop pc so that i can check the content. I already tried it with astro and fileexpert but there I cannot access the datafolder of my app. Is it possible to achieve this?

Thanks

Upvotes: 2

Views: 975

Answers (4)

Gabriel
Gabriel

Reputation: 476

If you want something more graphic, from the IDE Eclipse you can go to the perpective DDMS, select your device, and from the file explorer tab, look for the path /data/data/ <package name of your aplicacacion> /databases, select the file of you database and click on the button "pull a file" (located at the top right)

Then if you want to work with another graphic tool, you could use the firefox plugin "SQLite Manager" for example.

Upvotes: 0

Code-Apprentice
Code-Apprentice

Reputation: 83557

If you can plug your device into your development computer with a USB cord, you can use the adb tool. In particular, the command adb pull can be used to retrieve any file from your device. The database file is located at /data/data/<android_package_name>/database. Using a command-line the full command is:

adb pull /data/data<android_package_name/database

Then you can use the sqlite3 tool to connect to the database file and check that it is correct. Alternatively, you can use adb shell to connect directly to a command-line on your device and use the devices sqlite3 tool to check out the database. (Caveat emptor: This works on the emulator. I'm uncertain whether or not sqlite3 is installed physical devices.)

Upvotes: 1

user370305
user370305

Reputation: 109257

Using Application code you have to copy database file from /data/data/<application_package>/database/ directory to /mnt/sdcard then you can pull that file to your system.

Or You can run your application on Emulator then you can access it from /data/data/<application_package>/database/ as emulator is rooted.

Upvotes: 1

Chris Stratton
Chris Stratton

Reputation: 40397

Several options:

  • if the apk is still a debug build you can use the run-as command through the adb shell to copy the file to the external storage and then adb pull it from there. This requires some unix shell knowledge, and since there's no 'cp' binary most use cat and a redirect.

  • you can add functionality in the program to copy the file to the external storage for examination. You'll have to actually write the code to do the copy as there is no file copying function.

  • you can change the file's access permission to world readable, and directly adb pull it despite the fact that you won't be able to browse the directory tree it is under; consider printing the absolute path to logcat or determining it from the package information.

  • you can run on an emulator which is rooted by default

Upvotes: 0

Related Questions