We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
经群里大佬提点尝试后确认是权限的问题,现给出以下解决方案:
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
val PERMISSIONS_REQUEST_STORAGE = 1 // 检查 Android 版本 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { // 请求 MANAGE_EXTERNAL_STORAGE 权限 if (!Environment.isExternalStorageManager()) { val intent: Intent = Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION) val uri = Uri.fromParts("package", packageName, null) intent.setData(uri) startActivity(intent) } } else { // 针对 Android 10 及以下版本,申请 WRITE_EXTERNAL_STORAGE 权限 if (ContextCompat.checkSelfPermission( this, Manifest.permission.WRITE_EXTERNAL_STORAGE ) != PackageManager.PERMISSION_GRANTED ) { ActivityCompat.requestPermissions( this, arrayOf<String>(Manifest.permission.WRITE_EXTERNAL_STORAGE), PERMISSIONS_REQUEST_STORAGE ) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
经群里大佬提点尝试后确认是权限的问题,现给出以下解决方案:
The text was updated successfully, but these errors were encountered: