Search code examples
androidandroid-sdcardandroid-4.2-jelly-bean

How to view Android/data/your.package.name files on external storage in Android 4.2 with the multi user environment?


Android 4.2 added multi user support for tablets. Now when you request a path to save files on external storage via a method like Environment.getExternalStorageDirectory() or Context.getExternalFilesDir(null) you get a value like: /storage/emulated/#/Android/data/your.package.name/ The # being a number depending on what user you are currently logged in as.

This works fine but I have noticed that DDMS's File Explorer and also the Android File Transfer are not able to see these files.

DDMS's File Explorer cannot see anything past storage/emulated/ except an empty legacy folder. File Transfer can see the /Android/data/ folder but for an app running as debug, its files are not visible (but they do exist).

Is there any way to get DDMS or File Transfer to work with these devices? (Hopefully without having to root the device...)

Thanks


Solution

  • Aha!

    Try /mnt/shell/emulated/N, for various values of N like 0. That seems to map properly on my Nexus 10 and my Galaxy Nexus in DDMS. I cannot comment on the File Transfer tool, though.

    BTW, the numbers are not sequential for the users. So on my N10, the original user is 0, the second user is 10.