Displaying Image from "external_storage" not working in compiled apk

as test keep the AskForPermisson block in the Screen.Initialize event and move all other blocks into for example a button click event
it should be possible to display the image from any folder after having received READ_EXTERNAL_STORAGE permission, see also the overview Some basics on Android storage system - #24 by bodymindpower

Taifun

I notice that the path for the image from telegram contains a space,

file:///storage/emulated/0/Telegram/Telegram Images/858105162_345555.jpg

should this be escaped or something maybe? or is this not needed in kodular?

thanks

You could replace the space by %20 to find out, if this makes a difference

Taifun

Can you try any other folder that is not created by any app(manually create a folder).

This shouldn’t be a problem.

Try this APK → imageTest.apk (5.9 MB)

Copy foto.jpg from the assets into this path beforehand:
/storage/emulated/0/Telegram/Telegram Images/foto.jpg.

grafik

Android 11:

So I made a little test app this morning to try this again…


newtest.apk (5.3 MB)
newtest.aia (100.5 KB)

This has a test.png as an asset, and on pressing the copy button will copy that image to

  • root of storage (/emulated/0/)
  • folder in root of storage (/emulated/0/ktest)
  • folder with space in root of storage (/emulated/0/k test/)
  • telegram image folder (/storage/emulated/0/Telegram/Telegram Images/)

it then reloads and shows filetools exists true/false + the full path, then the image.

this all works on the companion -

but doesn’t work atall on my phone, even the copy command isn’t working, even though i have storage permissions and request permissions at the start of the app, as per the blocks aia -

little stuck for ideas now :frowning:

Please see video, your app also doesn’t work for me…

No wonder

grafik

As I said, copy foto.jpg from the assets to that path …

Is it really that difficult to do this manually:

Since it is no longer possible to do this via the app on Android 11
(without using the → Storage Access Framework / SAF).

Did you not watch my video? I did it manually via es file explorer, I don’t see why you think that wouldn’t work?? The second time I open the app it says true, but still doesn’t show…

Just so you can see, your picture, copied from the assets, into the

/storage/emulated/0/Telegram/Telegram Images/foto.jpg .

location, but still not showing, notice how the “exists” flag is true…

in your test program you are calling the procedures cleanUp and display from the Screen.Initialize event…
this will not work, because you still do not have the required permission at this time…
you should call these procedures in a button.click event and click that button after having granted permissions…
you can remove WRITE_EXTERNAL_STORAGE, this does not exist anymore…

Taifun

I tried this, it didn’t make any difference…

Try this: imageTest2.apk (5.9 MB)

(It seems that some special devices need this path (for whatever reason):
file:///sdcard/Telegram/Telegram Images/foto.jpg

Sadly still no luck :frowning:

I have also tried most these apk’s on a Samsung Galaxy S21 Ultra as well as my Oneplus 8, but both do the same.

The next attempt (this time with an absolute path, and not a full path):
imageTest3.apk (5.9 MB)

Blocks

The absolute path works on all of my Android 11 devices as well.
/sdcard/Telegram/Telegram Images/foto.jpg

Full path:
file:///sdcard/Telegram/Telegram Images/foto.jpg

Annoyingly…still no luck :frowning: I tried this on both the Oneplus 8 and the S21

That’s really strange … but we’re not giving up yet:wink:
Next attempt with an extension:
imageTest4.apk (6.1 MB)

Btw, I checked my APKs on many test devices (Android 7, 8, 9, 10, 11). Also on Samsung and OnePlus devices. All APKs (1-4) work on all devices.
I have no idea what’s going on on your devices.

Try also the AI2 version:
imageTestAI2.apk (4.2 MB)

:frowning: neither of these work either…I guess I am going to have to think of a different way to do it…

all of mine “work” in the compainion app, thats the strange thing as well…