The first time the application starts, we make a request for the
Manifest.permission.READ_EXTERNAL_STORAGE permission, approve it, and try to get an image from the gallery. When I try to do something with the file, I get
java.io.FileNotFoundException: /storage/emulated/0/Download/temporary_file.png: open failed: EACCES (Permission denied)
If you restart the application, then the permission is not requested again, since it has already been confirmed, and everything works as it should, the files from the gallery are normally retrieved.
At the moment, the "problem of one device" is reproduced only by me, and by one more person. But something tells me that there will be more devices with a recurring problem.
Playable on Nexus 5 with android 6.0 and 6.0.1
Everything works fine on Nexus 6.
I also made a test project on which the problem is reproduced
In general, I found out that this is a bug in the firmware. Detailed description
So far, I managed not quite a cool solution, but a working one.
If you set
targetSdkVersion 22 , then permissions start working the old fashioned way.