System.getenv(QUOT; SECONDARY_STORAG​​E")在一些设备返回NULL [英] System.getenv("SECONDARY_STORAGE") return null on some devices

查看:177
本文介绍了System.getenv(QUOT; SECONDARY_STORAG​​E")在一些设备返回NULL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图让Android设备,并在某些设备指令外部存储器的List System.getenv(SECONDARY_STORAG​​E); 收益无效虽然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_STORAG​​E)可以返回

Someone know in what cases System.getenv("SECONDARY_STORAGE") can return null?

非常感谢

推荐答案

在我的实验,
一些旧的HTC设备将返回null当你调用 System.getenv(SECONDARY_STORAG​​E)

我发现,在这类设备的实际的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_STORAG​​E")在一些设备返回NULL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆