Facing problems with permission to access app photos media and files

Dear friends, I’m facing a problem in my app with permissions.

I have an app that when the user clicks a button, the app call the camera to take a picture. When the picture is taken, this picture should replace the button old picture.

But only in THE FIRST launch of the app, android asks for permition to access photos media and files, AFTER the picture is taken, so when I agree the access I can’t replace the button old picture without taking the photo again.

I would like to ask this permission before taking the photo. How can I do it?

1 Like

welcome to community, can you please show me your blocks

1 Like

Thank you very much for your attention! 10

1 Like

these blocks are fine, error must be somewhere else

1 Like

see an example here


Taifun

2 Likes

Dear samiu8336, the blocks works fine, but the problem is the timing between taking the picture and the application asking for permission.
As the logic is saying, I take the picture, after that when the code tries to set the button1.image the first time the app is running, the app “sets” the image without the permission, so I get a grey image over the button. And after that, the android system asks me about the permission.

it should have some manner to force the android to ask the permition before I take the picture, understand?

Sorry for my bad english

1 Like

then use this block when screen initialize or when camera button click
android.permission.WRITE_EXTERNAL_STORAGE
blocks%20(18)

3 Likes

Dear Taifun, thank you very much for your attention! Worked perfectly! Thank you guys for all attention!

Best regards

Carlos

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.