keinabel keinabel - 1 month ago 6
Android Question

How do I get the files I stored with my app (Android) on my PC?

I created json files on the internal (private) storage of the app I write for my

Google Nexus 5
.

I was told, that this is the so-called private app space which I cannot access from my PC unless I either root the phone (not an option) or use the work-around by making backups via adb.

I tried to get access via
adb shell
.
But whenever I try to access the `data? directory I am being told I don't have permissions to access that directory.

How do I get access to this directory and to my files?


Note: I also was told that I should try to use
Environment.getExternalStorageState()
instead of writing into the private app space. But when I try to write to
/storage/emulated/0/
it just won't work either.


I don't care which approach to use, I just need access to the files I create on my PC asap.

Answer

This did the job:

adb shell
run-as PACKAGE.NAME
chmod 771 files
cp files/*.json /sdcard/<SOME_DIR>
adb pull /sdcard/<SOME_DIR> <SOME_LOCAL_DIR>

other possible solution that also worked for me:

adb backup -noapk PACKAGE.NAME
dd if=backup.ab bs=24 skip=1|openssl zlib -d > backup.tar
tar -zxvf backup.tar
Comments