solution
people need to upload the latest file in Android10, declare and dynamically apply for permissions, but it still indicates that the file cannot be opened. To solve this problem, the following steps should be done:
permissions that are requested in the Manifest file
< USES – permission android: name = “android. Permission. WRITE_EXTERNAL_STORAGE”/& gt;
< USES – permission android: name = “android. Permission. READ_INTERNAL_STORAGE”/& gt;
- dynamically applies for read file permissions (called in the activity)
private final int REQUEST_EXTERNAL_STORAGE = 1;
private String[] PERMISSIONS_STORAGE = {
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.WRITE_EXTERNAL_STORAGE };
public void verifyStoragePermissions(Activity activity) {
// Check if we have write permission
int permission = ActivityCompat.checkSelfPermission(activity,
Manifest.permission.WRITE_EXTERNAL_STORAGE);
if (permission != PackageManager.PERMISSION_GRANTED) {
// We don't have permission so prompt the user
ActivityCompat.requestPermissions(activity, PERMISSIONS_STORAGE,
REQUEST_EXTERNAL_STORAGE);
}
}
-
The new Android10
- requires a property
to be declared in the Application
< application
Android: requestLegacyExternalStorage = “true”/& gt;
at this point, you can really read the files in the system.
Read More:
- Solve the problem of dynamically applying for permission, but still reporting an error of open failed: eacces (permission denied)
- Developing in Android java.net.SocketException : socket failed: eacces (permission denied) reported an error
- Unhandled rejection Error: EACCES: permission denied, open ‘/Users
- Unhandled rejection Error: EACCES: permission denied
- mac Error: EACCES: permission denied, mkdir ‘./cache’
- NPM ERR! Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’
- move_uploaded_file() failed to open stream: Permission denied
- ERROR: While executing gem … (Errno::EACCES) Permission denied @ dir_s_mkdir – /var/lib/gems
- Permission error: [errno 13] permission denied: ‘… ” xxx.pyd ‘
- error: cannot open .git/FETCH_ Head: permission denied resolved
- session_ start(): open(SESSION_ FILE, O_ Rdwr)) failed: processing of permission denied (13)
- Error: EACCES: permission denied, access ‘/usr/local/lib/node_modules’ npm ERR! at Error (native)
- php open(/var/lib/php/session/sess_4ofxxx, O_RDWR) failed: Permission denied (13)
- PHP error Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0 Fatal error:
- Git error: no permission remote: error: unable to unlink old ‘ README.md ‘ (Permission denied)
- [git] report error and solve cannot open.git/fetch_ HEAD: Permission denied
- failed (13: Permission denied) while reading upstream [How to Solve]
- Solution: how to set program permission as administrator permission in vs2019
- Beeline connection hive2 reports an error permission denied
- Solutions for permission denied