Close the app if a permission is denied (but not before)

Hi Koders!
I want the app to be closed if the WRITE_EXTERNAL_STORAGE is denied when this dialog is showed, meaning, when the “DENY” option is selected.
imagen
But the problem is the app is closed before any option is selected, deny or allow, but this dialog is not closed.
I’m using this block:
blocks(3)

What I’m doing wrong? Should I use another block?
Thanks.

So I suspect that WRITE permission is not declared in the Manifest.

If WRITE permission is not declared in the Manifest, this permission cannot be requested, i.e. it cannot be denied (or granted). Therefore it is denied immediately and the app is closed.

1 Like

You can Use If then Else, For this.

First of all Write a Manifest for Write Permission for Media. And then set a Control block. When Screen Initialise >> If >> Write Permission Allow then >> Open another Screen or what ever else >> Close application.

1 Like

Before using the “when Screen1 Permission Denied”, the app request the permission when a certain block is clicked (This button starts the download of some pics needed for the app to work) and then the “Allow…” dialog is showed. If the “when Screen1 Permission Denied” block is empty or not used, there is no problem, the app is not closed and if you click “ALLOW” the download starts and everything is ok.

But if you click “DENY” the dialog is closed but the app remains open and the user can’t do anything. Thats why I want to use the “when Screen1 Permission Denied” block.

If the problem was that the WRITE permission is not declared in the Manifest, the app would be closed anyway when this dialog is showed, but this is not happening now if the “when Screen1 Permission Denied” block is not used or empty.

So I think that maybe there is another kind of problem.

Thanks for your help!

Which Android version are you testing on?

If you download your images to the ASD, you don’t need READ / WRITE permissions. But, if you want to display an image with the Image component, it needs (incorrectly) READ permission (which is of course a bug).

1 Like

I tested on two different devices, one is 6.0 and the other is 7.1.1.

I changed the WRITE_EXTERNAL_STORAGE permission for the READ_EXTERNAL_STORAGE and the problem is solved.
(I’d rather to ask for the permission when the images are going to be downloaded, so the user knows why the permission is granted).

Thanks so much @bodymindpower!

1 Like

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