现在android 9.0是如何读取外置SD卡权限的?我试过动态和静态申请都不行,在线等,急急急~
听别人说用DocumentUI,这个怎样用,网上搜到的方法很少~
现在android 9.0是如何读取外置SD卡权限的?我试过动态和静态申请都不行,在线等,急急急~
听别人说用DocumentUI,这个怎样用,网上搜到的方法很少~
方法已解决:因为android 9.0访问的方式不同了,换个访问方式,可以使用DocumetUi去解决,因为项目紧急,我还没有深入去研究,用了别的方式去访问,代码如下:
File file = null;
for (File files : mContext.getExternalFilesDirs(Environment.DIRECTORY_DOWNLOADS)) {
if (Environment.isExternalStorageRemovable(files)) {
file = files; }
}
if (null == file) {
throw new UnsupportedOperationException();
}
return file == null ?
null : file.getAbsolutePath();