Problem with Android 11 accessing Storage

Hey everyone,

I remember reading somewhere that Android 11 doesn't allow you to access the storage of your phone using Appinventor.

My app is all about taking a photo, and then tweeting / emailing it. It works perfectly on Android 9, but on Android 11, it doesn't attach the image.

My App takes a photo using the Camera Component, Displays it in an image, and then shares it by using the image.picture block. But, as the image.picture also leads to the internal storage, the app doesn't work.

As Android 11 is the newest Android version, many people will be using it, and my app will essentially not work for them. So, is there any way to go around this rule?

Thanks in advance.

Show you blocks and read this first:

Here they are:

Also, upon further testing, I am facing the same issue on an Android 10 Device as well.

(If the blocks in the image aren't legible, then just right click --> open image in new tab and zoom in )

1 Like

Also, I don't think that the problem is anything with the tempComponent variable, as in an earlier version of the App, the when any image.click wasn't there, as it would straightway choose image1.picture in the attachment column

Also see

The problem seems to be with the Android 10 / 11 or maybe because both the Android 10 and 11 are OnePlus phones and the Android 9 is a Samsung phone

and post the result of grafik

Do It Result: "["/storage/emulated/0/Pictures/app_inventor_1619768163890.jpg"]"

(Right now, I have tested all of this on the Android 9 phone)

Ok, and this image does not exist on Android 10+ (in this path).
The image is saved in the ASD.

Oh, I got it. Can you tell me is there any way to check the Android Version of the current device, and then accordingly I'll make it enter the path ?

Android > 9:

grafik

See also here:

Thanks ! I'll just look it up and then if it works; will mark it as solution.

Just curious, shouldn't the path of the picture, by default, be that of how it is saved? Like I am only removing file:// from the path of the image already there, not specifying another path.

So, even if the paths are different, the segment text block should still edit it the same way and give the result respective to what the original path was?

Hope i'm not confusing you :upside_down_face:

Yes, make a test on your Android 10+ device and check ...

Take a look at your topic!
Does it make sense to test on an Android 9 device (when I'm trying to help you with an Android 11 problem)?

2 Likes

Sorry, the Android 11 Device is my mother's phone, and she was using it, so I couldn't test using it.

Right now, upon testing with the Android 11 Phone, I still wasn't able to figure out how exactly do I solve my problem.

I even tried giving the full file path (/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/Pictures/app_inventor_1619777203718.jpg) as an attachment, but it still isn't working.

Even If I use that extension, how exactly do I make it work?

Did you check if this file exist?

grafik

to copy into this directory
Unbenannt
will not be possible anymore after App Inventor targets SDK 30...
you should completely remove that block, because the image will be stored in the ASD anyway...

Taifun

It's False. What could be causing this? (I removed the copyfile block, but the result is still false.

Hi, I thought of one way in which I might be able to make it work - if I use the Component to Image Extension, and then the output of which I can use in the attachment column of the share block.

Do you think it would work? I will try it, and then get back.