Where is my sdcard location on 4.4.2?

后端 未结 3 1422
情话喂你
情话喂你 2020-12-31 05:28

On Android 4.4.2 Environment.getExternalStorageDirectory().getPath() returns /storage/emulated/0 but this path does not exist on my Nexus5 Android

3条回答
  •  自闭症患者
    2020-12-31 06:04

    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.

提交回复
热议问题