-1

When I first start the application requests permission Manifest.permission.READ_EXTERNAL_STORAGE, I approve it, and try to get a picture of's Galleries. If you try to do something with a file, I get

java.io.FileNotFoundException: /storage/emulated/0/Download/temporary_file.png: open failed: EACCES (Permission denied)

After restart app, the permit is not requested again, because it is already confirmed, and everything works as it should, the files of the gallery normally gets.

Reproduced on the Nexus 5 c android 6.0 and 6.0.1
On the Nexus 6 working all ok.

Just did a test project, which reproduces the problem

Community
  • 1
  • 1
andreich
  • 1,120
  • 1
  • 11
  • 28
  • Stack Overflow is for programming questions. What is your question? – CommonsWare Dec 28 '15 at 12:30
  • 2
    @CommonsWare I can't do anyting with file from gallery. If you read closely, you will see that there is a link to the source code – andreich Dec 28 '15 at 12:32
  • instead of restarting the app, if you just wait for a few minute, does it works? – Rusheel Jain Dec 28 '15 at 12:42
  • Does Kotlin have a listener, callback, etc when you accept the permission? After that gets you the OK, you should try to open the gallery. Clearly the accept button of the popup is giving you a true boolean but the permission still not granted. – Mariano Zorrilla Dec 28 '15 at 13:10
  • @MarianoZorrilla it not help – andreich Dec 28 '15 at 13:16
  • Try to debug with a double check. Use the button only for grant the permission and use another button to check if the permission is granted. Don't know how to do it on Kt but here is an example in xaramin: https://blog.xamarin.com/requesting-runtime-permissions-in-android-marshmallow/ and simple Java: http://stackoverflow.com/questions/30719047/android-m-check-runtime-permission-how-to-determine-if-the-user-checked-nev you have a "OnRequestPermissionsResult" – Mariano Zorrilla Dec 28 '15 at 13:18
  • @MarianoZorrilla I updated my example project and add flow. Gallery opens just aftera allowed permission, but problem not solved – andreich Dec 28 '15 at 13:26

1 Answers1

1

This is bug in android. More details
I set targetSdkVersion 22.
Permissions to work as previous versions of Android

andreich
  • 1,120
  • 1
  • 11
  • 28