Asking permission until it's granted - currently only asks twice

Hi,

I'm using Activity Starter to store images, and I'm running into a couple of issues. Is there any way to get the "Ask Permissions" popup to show every time the user clicks a button, up until they finally give permission?

Currently, they'll only be asked twice, and then even after closing the app and granting the necessary permissions, nothing happens - rather, the old message, "Error 908: The permission WRITE_EXTERNAL_STORAGE has been denied. Please enable it in the Settings app", pops up every time the "Add Image" button is pressed. The idea is that the user shouldn't be able to select an image unless WRITE permission has been granted.

Here are my blocks, if it helps:

Any help would be appreciated. TIA

1 If your Android version is 11 or later, there is no such permission as WriteExternalStorage, so it will never be granted.
2 in your blocks, 'Permission Write External Storage ' will never be equal to true.

Hmm... So how would I ask for permission? The app stops working when I try to display images I've saved via Activity Starter, but it displays them once I turn on the media permissions.

(I'm on Android 13, btw.)

then where did you save your image? why not use Image Picker component?

I would like to clarify this a bit:
If WRITE permission is declared in the Manifest (DefaultFileScope = Legacy) and WRITE is requested on Android 11+, the PermissionGranted event returns (incorrectly) WRITE_EXTERNAL_STORGE. However, this permission no longer exists on Android 11+, which means that instead of WRITE permission, only READ permission is granted.

Everything clear so far? :wink:

2 Likes

Add e.g. the File component, check ReadPermission in the Properties of the File component (in Designer) and then request READ_EXTERNAL_STORGE:

READ permission exists on all Android version and you have access to all media files in all locations of the external storage on all Android versions. See also my overview here.

To make it short:
WRITE permission always implicitly grants READ permission. However, since WRITE permission is no longer available there, only READ is granted on Android 11+.

Use the PermisionDenied Event and ask again for permission
Taifun

No.

After the user denied the permission for the second time you can no longer request it again.

Image Picker only allows you to save 10 images. I tried using TinyDB to somehow overcome this, but that doesn't work. Activity Starter was suggested as an alternative, but it requires permissions.

Thanks! The issue is, if permissions are turned off after images have been saved, when I go to view them through the app, the app crashes. It will keep crashing until I turn the permissions back on. While I myself know what the problem and fix would be, my users probably won't, so this constant crashing will just make the app look unstable.

I'm also concerned about this message that I get when I go to turn on permissions: "This app doesn't support the latest version of Android. If this app can access photos and videos, it will also be allowed to access music and audio files."

Does this have something to do with using Activity Starter?

If there is a way to save more than 10 images using ImagePicker, thus overriding the Write/Read requirement, I'd much prefer this, as Activity Starter needs permissions, and I'd rather not have to ask for them.

Post a screenshot of this message.

:question:

Sorry, what I mean is that the ImagePicker doesn't ask for permissions, so I'd prefer to use that for choosing images. Is there a way to save more than 10 (the limit says 10)? I tried saving them to TinyDB, but they still get overwritten. Would moving (and renaming) the file using Taifun's file manager extension, then saving it to TinyDB work?

The limit is for picking, not for saving...

Because you are saving the path to the picked images

Yes... you also could use the file component...

Taifun

One explanation is here:

Post the AIA (or a test AIA) showing this permission request.

Thanks for your help. I managed to get around this by simply using the ImagePicker.

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