ImagePicker is redirected to the ASD for Android 10+

Yes, but what sense should it make that the image is saved in the ASD after every pick. In addition, if the same image is selected several times, a new image is created in the ASD after each opening (.AfterPicking), so that the memory is superfluously filled.

In addition, no image can be selected from the ASD with the ImagePicker (at least not under Android 11). The user would probably like to know which image he / she has accessed from which location. The ASD path and the image name generated there does not say anything about it.

So I think this (historical) approach might be reconsidered.

Screenshot

Btw, the picture selected here comes from the /Download folder.

1 Like

If you do not like it, you alternatively can use the activity starter...

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

2 Likes

This assumes that the images on disk are not going to change between subsequent invocations of the image picker, which is too strong of an assumption in the general case. Technically, it might even be possible (although highly unlikely) that an image could change between when it is picked and when App Inventor copies it to App Inventor's working directory. This behavior ensures that for the average App Inventor user once they've picked an image it will remain and be available for them to manipulate.

This is an unfortunate side effect of Google's rule changes. The goal is that eventually people could write to the shared storage so that the picker would be able to use those images.

1 Like

This is the best method. :+1:
Everything under developer's control.
No need to worry about future changes, as long as files are at least readable.

1 Like

Yes, of course, but even with this it is not possible to select an image from the ASD.
However, I have found a way via an extension with which images (files) can also be picked from the ASD with targetSdk = 30.

Question:
Is possibly something missing in the overview? Because what about the added (blue) part (WRITE → Own app)?

Is there any way to write (save) → non-media files e.g. to /Documents or /Download (targetSDK=30, without MANAGE_EXTERNAL_STORAGE permission)? Probably not, but I'm not 100% sure.

See also here.

Summary

It would be nice if someone would shed a little more light into the darkness here.
(It's a little opaque, at least to me.)

1 Like

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):

testASD

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?