Accessing Android databases from device

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

open command prompt
cd platform-tools
./adb shell
run-as applicantion.package.from.androidmanifest.xml
cd databases
##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
cd /data/data/yourpackagename
cp mydatabasefile.db /sdcard

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..


Leave a Reply

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

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

Facebook photo

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

Connecting to %s