System.getenv(QUOT; SECONDARY_STORAGE")在一些设备返回NULL [英] System.getenv("SECONDARY_STORAGE") return null on some devices
问题描述
我试图让Android设备,并在某些设备指令外部存储器的List System.getenv(SECONDARY_STORAGE);
收益无效
虽然SD卡安装在设备(4.1.1)。
I'm trying to get a List of external storages on android devices and in some devices the instruction System.getenv("SECONDARY_STORAGE");
returns null
although the sd card is mounted in the device (4.1.1).
我使用的是 Dimitriy 解决方案,做到这一点,工作正常,但在某些设备我有这个问题。
I'm using the Dimitriy solution to do this and works fine but in some devices I'm having this problem.
有人知道在何种情况下 System.getenv(SECONDARY_STORAGE)
可以返回空
Someone know in what cases System.getenv("SECONDARY_STORAGE")
can return null
?
非常感谢
推荐答案
在我的实验,
一些旧的HTC设备将返回null当你调用 System.getenv(SECONDARY_STORAGE)
我发现,在这类设备的实际的microSD路径安装在
I found that the actual microSD path in such devices is be mounted in
/storage/sdcard0/ext_sd/
/sdcard2/
/mnt/sdcard/ext_sd/
由于外部存储环境变量由手机制造商定义。
我们没有一个API来准确获取的microSD路径。
Due to external storage environment variable is defined by phone manufacturers. We don't have a API to exactly get the microSD path.
这篇关于System.getenv(QUOT; SECONDARY_STORAGE")在一些设备返回NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!