On Android 4.4.2 Environment.getExternalStorageDirectory().getPath()
returns /storage/emulated/0
but this path does not exist on my Nexus5 Android
This path does not exist on my Nexus5 Android 4.4.2.
Yes, it does, for your process at runtime.
For example, this sample project downloads a file to Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS)
. If you log the location at runtime, when running it on a Nexus 5, it is reported as /storage/emulated/0/Download
. And the download succeeds.
If you are looking for /storage/emulated/0
via DDMS or adb shell
, you will not find it. For those tools, default external storage is /mnt/shell/emulated/0
. Hence, the downloaded file from the above sample appears in the /mnt/shell/emulated/0/Download
directory.
AFAIK, the difference is tied to providing separate external storage to secondary accounts.