4

I wrote an app that reads and writes a couple of data files. When I call the method getFilesDir() it returns /data/data/nel.prog.MyApp99/files (assuming my app is called MyApp99).

So how do I see that on my PC?

When I attach my phone as a debugging target to my (XP) PC I get 2 external drives created - one for the phone itself and one for the SD card, and I can't find that path in either one! In XP I set my "Folder options" to show hidden files and folders and to not hide protected operating system files. I can see a lot of stuff (i.e., lots of files and folders on both the phone and SD card). But I don't see the above path nor the data files themselves.

Where are they and how do I access them? Thanks in advance!

2 Answers 2

3

You can use adb (Android Debug Bridge) in your adk/tools dir to copy files or start a remote shell (and then list files/contents).

adb pull <remote> <local>   // copy files

adb shell    // start shell

Update:

Above commands only work from a computer connected to Android device.

For sharing files between apps on device you should check out: http://developer.android.com/guide/topics/security/security.html#userid

6
  • Instead of that, is there a way I can set a path to write and read my files to someplace that's NOT inaccessible? If so, is there a "standard" place for apps to write their data to that's public (in the phone storage, not the SD card because not everyone has one) -tnx Feb 19, 2011 at 20:49
  • @Peter Knego: The adb trick will only work on the emulator, or possibly rooted phones. Feb 19, 2011 at 20:59
  • Each app is installed under separate user ID, so they don't have access to each other files. Also, each app has only privileges to its own directory where it is installed. Feb 19, 2011 at 20:59
  • Nelson: "If so, is there a "standard" place for apps to write their data to that's public (in the phone storage, not the SD card because not everyone has one)" -- no. If you need access to your files, test on the emulator, or implement a backup/restore feature that uses external storage. Feb 19, 2011 at 21:00
  • Part of my test plan is to make sure my app handles it correctly/gracefully when data files are missing, renamed, or altered/corrupt. Testing on the emulator is OK to a point, but I want to make sure everything works properly on an actual device, too. Feb 19, 2011 at 21:45
2

Your phone must be rooted to be able to access the /data directory. Once you did it you can use a tool like DroidExplorer to browse this folder.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.