Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can one pull the (private) data of one's own Android app?

Tags:

android

adb

Attempting to pull a single file using

adb pull /data/data/com.corp.appName/files/myFile.txt myFile.txt 

fails with

failed to copy '/data/data/com.corp.appName/files/myFile.txt myFile.txt' to 'myFile.txt': Permission denied 

despite that USB debugging is enabled on the device.

We can go around the problem through the archaic route

adb shell run-as com.corp.appName cat files/myFile.txt > myFile.txt 

but this is unwieldy for more than one file.

How can I pull the directory /data/data/com.corp.appName/files to my MacBook?

Doing this either directly or through a transit in `/storage/sdcard0/myDir (from where I can continue with Android File Transfer) is fine.

Additional Comment

It may be that just running

adb backup  -f myFiles com.corp.appName 

will generate the files I am looking for. In that case I am looking for a way to untar/unzip the resulting backup!

like image 921
Calaf Avatar asked Mar 21 '13 21:03

Calaf


People also ask

How do I access private data app on Android?

Access private files GUI — In Android Studio, launch Android Device Monitor from the menu: Tools/Android/Android Device Monitor. Navigate to the File Explorer tab, then data/data/<your app package name>/. Find the file you are looking for, and you can push and pull a file from there.

How do I open Android backup files?

How to open a BACKUP file. To restore a BACKUP file, first hold the power button and volume button on your Android device to start the device in System Recovery Mode. Then, select the option to restore user information from the System Recovery menu.


1 Answers

adb backup will write an Android-specific archive:

adb backup  -f myAndroidBackup.ab  com.corp.appName 

This archive can be converted to tar format using:

dd if=myAndroidBackup.ab bs=4K iflag=skip_bytes skip=24 | openssl zlib -d > myAndroidBackup.tar 

Reference:

http://nelenkov.blogspot.ca/2012/06/unpacking-android-backups.html

Search for "Update" at that link.


Alternatively, use Android backup extractor to extract files from the Android backup (.ab) file.

like image 113
Calaf Avatar answered Dec 07 '22 23:12

Calaf