Picking an image and copying it to ASD

Hi,
I'm trying to avoid using ImagePicker to overcome its limitation of 10 files.

I've used the ActivityStarter method as described in:
https://puravidaapps.com/snippets.php#2imagepicker

After getting the URI, I've translated/transformed it to a file path.

I've tried copying this selected file to the ASD using:

  1. AI file component.
  2. Taifun file ext.
  3. Sunny Gupta ext.

I've tried everything I can, using Scope, checking existence first, relative and full path, with single/double/triple "/".

My mobile has Android 11 installed
I know there are many posts and discussions regarding storage and permission etc, please don't point me to these, as I've already tried my best to find an answer. (Note, I'm checking my solution with apk installation only, no need for companion solution)

  1. Can someone please provide with the required blocks/logic?
    Again, I'm just trying to do what the ImagePicker does.
    The ImagePicker does this without asking for any permission, but I've tried asking for permissions as well.

  2. I read that for Android >= 10, an app can't access the shared scope, only ASD.
    So how do commercial apps (e.g. Telgram) creates and uses a dedicated directory under /storage/emulated/0 ? (i.e. not in ASD)

Thanks a lot,
Eran.

Show your blocks (and a test aia).

No problem with all (1 - 3), not even on Android 11.

Thank you for your attention.

I've build 2 tests.

Test 1:

Try_ImgPick.aia (36.0 KB)

Result (Screen shot):

Test2:
Try2_ImgPick.aia (36.0 KB)

Result:

I appreciate your help,
Eran.

for the first solution I would try to start the relative path with a slash...
/DCIM/Camera/...

for the second solution I would try to first ask for READ_EXTERNAL_STORAGE permission in Screen.Initialize using the AskForPermission method...

Taifun


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

1st: Added a slash, still fails

2nd: Added the READ_EXTERNAL_STORAGE request -> Success!
Thanks!

I still would like to understand how the ImagePicker does this without permission?
And how commercial apps creates and uses a dedicated directory?

Hello, i am new here.

Help me!

After taking a photo, resizing it, I copy it to the Download/Photos/imagename.jpg folder

Now I want to set image1 to receive the copied photo, how do I do that?

Another question, how do I rotate the photos obtained through the activity starter, since it comes from a resultURI?

Android 13

Try the absolute file name, which is
file:///storage/emulated/0/Download/Fotos/...

Show us a Do it result

Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools

Taifun


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

When I try to rotate an image from activy starter the result is eacces permission denied!


It worked, but when I rotate the image that came from the camera, after it was copied, it disappears.

However, in the Fotos folder, the image rotates, but does not show in Image1.

Try a full path: file:///storage/emulated/0/...

grafik

Some devices (Android versions) require a full path. For others, the absolute path is sufficient, but the full path should always work.

Thanks, it worked!.

Just one more question!
When I try to rotate an image from activy starter the result is "open failed: eacces permission denied!" and, it doesn't resize either.

Picking an image and copying it to ASD

Why not just use the SAF extension, pick the file, save it out to the ASD, then fiddle about with that file?

I'm sorry, but I'm a beginner and I don't know how to use this SAF extension. I need to select image, copy it to a folder and if necessary, adjust, resize and rotate, and show it in Image1.

for example:

Why don't you just use the image picker component? As you copy the image to ASD, its limitation is not relevant for you

Taifun

Yes

Yes, but with the imagepicker the images are being overwritten, I've tried several times. How can I prevent them from being overwritten?

Pick an image and copy it to ASD, you may rename it as you like, then pick the next image

Taifun