Can anyone tell me, is it possible to use the ADB to pull and push a database from an app, without root privaliges on the phone?
For example, I know the location on my rooted magic and dream is:
While Nilhcem's answer didn't work for me, it lead me in the right direction (for that I upvoted) and I now have a working solution.
Old answer that may not work with newer versions of Android:
#Transfer file from app databases directory to PC adb shell $ run-as package.name $ cd ./databases/ $ ls -l #Find the current permissions - r=4, w=2, x=1 $ chmod 666 ./dbname.db $ exit $ exit adb pull /data/data/package.name/databases/dbname.db ~/Desktop/ #Transfer file from PC to app databases directory (requires the above permission change) adb push ~/Desktop/dbname.db /data/data/package.name/databases/dbname.db adb shell $ run-as package.name $ chmod 660 ./databases/dbname.db #Restore original permissions $ exit $ exit
Alternate method using external storage (confirmed to work with 6.0.1):
#Transfer file from app databases directory to external storage adb shell $ run-as package.name $ cp ./databases/dbname.db /sdcard/ $ exit $ exit #Transfer file from external storage to app databases directory adb shell $ run-as package.name $ cp /sdcard/dbname.db ./databases/ $ exit $ exit