Open salangheee opened 3 years ago
安卓存储权限在6.0后变成危险权限,在安卓11后变成特殊权限,需要以activity展示给用户看,需要: 1、升级targetSdkVersion和compileSdkVersion为30; 2、清单权限: manifest增加uses-permission: android:name="android.permission.READ_EXTERNAL_STORAGE android.permission.WRITE_EXTERNAL_STORAGE android.permission.MANAGE_EXTERNAL_STORAGE 3、动态申请: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { // 先判断有没有权限 if (Environment.isExternalStorageManager()) { //todo } else { Intent intent = new Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION); intent.setData(Uri.parse("package:" + context.getPackageName())); startActivityForResult(intent, REQUEST_CODE); } } 回调: @Override protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { if (Environment.isExternalStorageManager()) { //todo } else { //toast 存储权限获取失败 } } } //<R的跟以前的一样了
我也遇到这个问题了,不知道咋解决
Characters like /.?!|
create this problem. Avoid the occurrence of such characters in the file name.
.setPath(fileName)
Before Issue
FileDownloadLog.NEED_LOG=true
and review the Logcat output from main process and:filedownloader
process ( pay attention to Warn and Error level logcat)Issue
FileDownloadLog.NEED_LOG=true
?:filedownloader
process logcat请在Issue前认真的跟进上面提到的建议,这样将可以极大的加快你遇到问题的处理。