Image compatibility

Hello.
I have developped a sketch which works well on an old phone.
i tested it on an other one , and it doesn't display png image files so i yust make the new test sketch below...
the file is found and i have ok in label, but no image is display ....
i tested it with different image with same result (works on old phone but not on my redmi 7A !)
if i load thiss image in properties picture it is displayed !
is someone have idea ?

Android version?

If > 9, then the assets are here (with Companion):

/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/assets/

Hello Anke.
my android version is 11...but i have no the directory you talk about...
all the documents i loaded in apps are in /storage/emulated/0/Appinventor/assets...

Whatever the problem is not there because if i try to open an image in an other directory i have the same result...Furthermore file is detected by TaifunFile1.exists...

Of course, you have: → Pixel 2XL (Android 11)

Connect the device to your PC via USB.

No, this folder is never created on a Android ≥ 10 device.
If this folder is still there, it should be from times before Android 10 (AI2 nb184 release).

Yes you 'r right ! i didn't see it because i have lot of directory in data... :see_no_evil:

effectively if i use this directory the image is displayed...but what ? i can't display image from an other directory any more ?

Ok may be due to system updates...
so i can delete this directory now ?

This: /storage/emulated/0/Appinventor/assets
Yes.

ok thanks.

but what about loading images from other directory for exemple
emulated/0/documents...?
I succed to load it from " /storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/assets/" but not from an other dir !!

I have already explained this several times in other places. Search the forum.

Ok if i well understood, now from android 10 we can't read from directories any more.
the only one from which we can load files is the app one.and Taifun upgrade his file extension in order to go to "ApplicationSpecificDirectory".

but i'm in trouble whith it: when i try to update this extension , AI return me this :

did i well understand what happen?
what can i do with to upgrade extension without delete in (and all blocks using it) ?

you stil can read, but not store files everywhere anymore

try the following steps

  • export your project and store it in a save place as backup
  • copy the downloaded aia file and open it using 7zip
  • go to the folder assets/external_comps
  • to manually import an extension, open the aix file using 7zip, you now have two 7zip windows open in parallel
  • drag the main folder of the extension from the aix window into directory external_comps of the project and overwrite the existing old directory of the extension
  • upload the modified project into App Inventor

Taifun


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

Thank you Taifun I don't know why AI was angry but it works like that. :+1:

but if i can read it, why can't i directly display image from a file ?
the only way i found to make it work is to copy image file in a temporary file in "/storage/emulated/0/Android/data/edu.mit.appinventor.aicompanion3/files/assets/" and then i can display it !

and it seems that extentions can store in other directory, because my extension still do it (that's why i can't open file any more !)

At the moment, as we transition from Android 9 >> Android 11, different components will handle file paths in different ways, as you have seen.

When developing, you will need to bear this in mind, and seek to build in a robust and reliable file handling framework, based upon everything provided here in the forum.

We are hoping for a unified solution from MIT, but ensuring backwards (and forwards) compatibility does not make this an easy fix.

No, only if LegacyMode is enabled.
But then you can also save in the external storage (outside the ASD).

Both are no longer possible once AI2 targets API 30 (Android 11).
(→ at the end of 2021 at the latest)