[英]java.io.IOException: Permission denied Error when writing to removable SD card
I have give read and write permissions in manifest file and with code.我在清单文件和代码中赋予了读写权限。 I am able to create files in phone storage with no problems and its absolute path is
/storage/emulated/0
我可以毫无问题地在手机存储中创建文件,其绝对路径是
/storage/emulated/0
But When I try to write file in my removable sdcard with file.createNewFile() to thw path /mnt/media_rw/33A9-10F2
, it throws an error但是,当我尝试使用 file.createNewFile() 将文件写入可移动 sdcard 到路径
/mnt/media_rw/33A9-10F2
时,它会引发错误
java.io.IOException: Permission denied
It is possible to download a file from that location using Download manager.可以使用下载管理器从该位置下载文件。 Please help me to solve this issue...
请帮我解决这个问题...
You do not have read/write access to arbitrary locations on removable storage on Android 4.4+.您没有对 Android 4.4+ 上可移动存储上任意位置的读/写访问权限。
DownloadManager
is powered by a system app, and system apps have greater ability to work with the filesystem than do ordinary apps. DownloadManager
由系统应用程序驱动,系统应用程序比普通应用程序具有更大的文件系统工作能力。
I am able to create file in phone storage with no problems.
我可以毫无问题地在手机存储中创建文件。
You do not have access to most of external storage on Android 10 (by default) and Android R+ (for all apps).您无权访问 Android 10(默认)和 Android R+(适用于所有应用程序)上的大部分外部存储。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.