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

2

6

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

Pinkston answered 26/11, 2012 at 22:57 Comment(0)
V
13

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.

Volcanism answered 27/11, 2012 at 0:2 Comment(3)
YES! Thank you. You are like a magical wizard that travels around here and fixes things for people. Thanks again.Pinkston
Like you said this works in the File Explorer (DDMS) but not in the File Transfer tool. I can live with this!Pinkston
@littleFluffyKitty: Thanks! And you are like a, um, small, er, cuddly, uh, young cat! :-)Volcanism
I
3

As Jelly Bean 4.2 supports multi-user profiles, the sd-card browsing has been changed a bit.

You must have ADT v 21 or higher to browse emulated sd-card. /mnt/shell/emulated/0 is for default user. See the image attached for more detail.enter image description here

Enlarge Image

Ish answered 23/1, 2013 at 14:6 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.