小编Pal*_*hul的帖子

如何以编程方式获取android6.0中的SD_Card路径

我试图通过使用如下所示的外部存储路径来检查设备是否具有外部存储器

 if (new File("/ext_card/").exists()) {
        specialPath = "/ext_card/";
    } else if (new File("/mnt/sdcard/external_sd/").exists()) {
        specialPath = "/mnt/sdcard/external_sd/";
    } else if (new File("/storage/extSdCard/").exists()) {
        specialPath = "/storage/extSdCard/";
    } else if (new File("/mnt/extSdCard/").exists()) {
        specialPath = "/mnt/extSdCard/";
    } else if (new File("/mnt/sdcard/external_sd/").exists()) {
        specialPath = "/mnt/sdcard/external_sd/";
    } else if (new File("storage/sdcard1/").exists()) {
        specialPath = "storage/sdcard1/";
    }
Run Code Online (Sandbox Code Playgroud)

但是在棉花糖中,我无法找到这条路径,在使用ES FILEMANAGER进行检查时,他们会在Moto G第3代中提供类似存储/ 3263-3131.在检查其他棉花糖设备时,数字会有所不同.请帮我检查棉花糖设备是否有外部存储?如果找到存储意味着如何获取该外部存储的路径?

注意: - 我在我的应用程序中授予了存储权限,并在我的应用程序的设置中启用了存储权限.

提前谢谢,你在我的问题中发现任何错误请crt它.再次感谢你.

android android-6.0-marshmallow

8
推荐指数
1
解决办法
2万
查看次数

标签 统计

android ×1

android-6.0-marshmallow ×1