ImagePicker is redirected to the ASD for Android 10+

Yes, that is my question (but for non-media files).


See here. (Are they referring to folders (/Documents /Downloads) in the ASD?)

See also here:

This Scoped storage stuff is really confusing. :upside_down_face:

2 Likes

I definitely agree that the storage requirements are confusing. I'll have to run some tests on Android 9, 10, and 11 to better understand exactly what's going on here.

2 Likes

I don't understand how that can be Evan - the ASD should be accessible by the App, so we should provide App Inventor Users with a picker for images stored in the ASD.

But the actual behaviour should be to allow user to pick files from whole storage and not only from ASD, because ASD is only accessible to that particular app.

Yes, but neither the ImagePicker nor the Activity starter can access the ASD, at least as far as I know (and certainly not under Android 11). If you've found a way, show us.

As already said, I found a way to select (pick) the ASD directly with the help of an extension.

Maybe not an elegant method but as we know that files inside ASD can be accessed through File Manager extensions so list files and let user choose from it.But then you will have to rely completely on the 'custom' file picker.
I see a lot of apps using this kind of file picker, so that they don't rely on Android version completely.

Yes, of course, it is possible to list all files or those of a certain type. But this is definitely not a user-friendly method. It should therefore be possible in principle to select (pick) the ASD in order to be able to select any file and any subfolder from there.

Like this (with an extension, tested on Android 11, APK, also tested with targetSdk=30):

This is the same what I meant. :slightly_smiling_face:

I don't think that is possible with your FileTools or @Taifun's TaifunFile extension. You'll need at least one more extension. Otherwise show your approach.

Maybe a picker screen instead of dialog. :grinning:

The ImagePicker is implemented using an intent to launch the ACTION_PICK intent, which typically launches another application. That application won't necessarily be privy to the private data of the App Inventor app specific directory. This is where the breakdown occurs. I think the eventual goal will be to use the "Shared" scope to write to the shared directories so that apps would integrate correctly with tools like the ImagePicker. I'll have to double check, but I believe that the Camera and Camcorder components will still result in media in the DCIM folder, which would allow access to the ImagePicker, but components like Canvas will not since they don't save to the shared directories.

3 Likes

I know there is a lot to do right now.
But if there is any new insight on this, please let us know.

Will it eventually be possible for Canvas (and those other components) to save into a Shared folder?

1 Like

Thank you @Anke that is very clear!

Follow-up: Returning to the subject of this thread... will ImagePicker be able to access the Shared directory? Would it be appropriate for ImagePicker to use the DefaultFileScope (Shared vs ASD vs Legacy)?

I do not yet have a recent Android Device to test this on.

Yes.

It doesn't matter here.

1 Like

Something like this would be nice: https://stackoverflow.com/questions/41154120/apps-own-image-folder-in-uiimagepickercontroller

This refers to iOS / Swift.

Yes, but I thought the user experience presented at the link might be generalizable in the way it addresses:

How should the ImagePicker present the user with resources in both private storage (ASD) & shared storage?