Accessing Android databases from device

(I thought I wrote this down..)
Problem: how to access database on my Android device?

solution:
open command prompt
cd to ANDROID_SDK_HOME
cd platform-tools
./adb shell
run-as applicantion.package.from.androidmanifest.xml
cd databases
ls
##and here is the list of your databases

now, if we want to copy this to development computer, we do
cp mydatabasefile.db ..
cd ..
chmod 777 mydatabasefile.db
exit
cd /data/data/yourpackagename
cp mydatabasefile.db /sdcard
exit
exit

now you should be back in your pc shell, not in adb anymore

./adb pull /sdcard/mydatabasefile.db

now the file should be on your compewter

and finally, remove the file from sdcard

./adb shell
cd /sdcard
rm mydatabasefile.db

oh well, i used to be able to directly download it from the data folder after the chmod 777. maybe the 5.0 updated changed it or i just forgot.. need to document this stuff sooner lest i forget.

probably the extra copy before sdcard is not even required. and this editor eats all tags with any html like symbols.. whatever..

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s