Displaying Image from "external_storage" not working in compiled apk

Nope, nothing, I have uninstalled and reinstalled it, and set the permissions, but nothing :frowning:

this is not a question about reinstalling… you first have to grant the permission before you can access and display the image… you added the AskForPermission block during Screen.Initialize and continue to display the image without having received permission to access to the file…

therefore my guess is, it only does not work the first time, but might work all further times you start the app

Taifun

Ok, i’m not “clueless” when it comes to all this stuff, and have tried alot before having asked here…

I have installed, allowed it to request, fully close the app, then reopen it, it doesn’t display.

I showed a screenshot of the app permissions on my phone, after the first request it hasn’t asked again…but the image is not displayed, again notice that the “fileExists” command is saying true for both “images” so its able to see them, but not display.

And this DOES work via the companion app, just not when its compiled as apk.

I have modifed the apk to load a file from the root of an sdcard (emulated external storage), I have placed my image “test.png” of the root of the sd card, it shows in companion, but not in apk, maybe you can try it? you need to click the button on the first page to go to the second (as im also trying to accomplish this by sharing an image to my app)

newtest.apk (5.2 MB)

Interestingly, this does load the .png from the root of the sdcard when I run as an apk…

so maybe we can only load from the direct root?

As the exact same code, also says the image in the telgram folder is present, but doesn’t display it…strange

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.