我想将我的文档文件存储到'/存储/模拟/0/下载/'。我收到这个错误:
未处理的异常:FileSystemException:无法打开文件,路径 = '/storage/emulated/0/Download/file.pdf'(操作系统错误:权限被拒绝,errno = 13)
这是我的代码:
void download() async {
http.Response response = await http.post(url, headers: {"Accept": "application/json", HttpHeaders.authorizationHeader: 'Bearer'}});
File file = new File('/storage/emulated/0/Download/file.pdf');
await file.writeAsBytes(response.bodyBytes);
}
在Android Q中,您需要在AndroidManifest文件中添加以下几行:
<application
android:requestLegacyExternalStorage="true"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)