Some Android devices treat Internal Storage as SD Cards and External Storage as EXTSD

前端 未结 3 1913
离开以前
离开以前 2021-02-14 03:27

I have a bunch of Android devices from different vendors.

Some of them attach /mnt/sdcard to internal storage and /mnt/extsd to external storage(Scenar

3条回答
  •  伪装坚强ぢ
    2021-02-14 04:10

    Environment.getExternalStorageState() returns path to internal SD mount point like "/mnt/sdcard"
    

    Environment.getExternalStorageDirectory() refers to whatever the device manufacturer considered to be "external storage". On some devices, this is removable media, like an SD card. On some devices, this is a portion of on-device flash. Here, "external storage" means "the stuff accessible via USB Mass Storage mode when mounted on a host machine", at least for Android 2.x and above.

    But the question is about external SD. How to get a path like "/mnt/sdcard/external_sd" (it may differ from device to device)?
    

    Android has no concept of "external SD", aside from external storage, as described above.

    If a device manufacturer has elected to have external storage be on-board flash and also has an SD card, you will need to contact that manufacturer to determine whether or not you can use the SD card (not guaranteed) and what the rules are for using it, such as what path to use for it.

提交回复
热议问题