Read .pdf File from Documents Folder

Hi there,

i am going to reopen that case.

i want to open some pdf files, located in Documents/subfolder/file-x.pdf

the pdf-files getting uploaded by pc or by another app.

i have found this:

but i don't think this helps, because i do not have those files in the assets (and i do not know what assets are =D)

i tried different ways to open those files:

i have also a file component added for setting file scope to legacy, after i did that, Adobe PDF Reader opens and gives an Error like "File can not open"

Maybe you can give me some help, how i can fix my problems.

In the End i want to Download some pdf files from a nextcloud to the phone (done by synchronisation app) and open those files via my app.

What have you tried with this ViewPDF extension? the pdf file don't have to be in assets or asd.
and Assets means you upload the file to Media when developing the app.

1 Like

Which means you have to use SAF to access the files, see also Some basics on Android storage system

Taifun

2 Likes

Thank you for the hint.

maybe you can help me a bit. What does SAF exactly do? is it to set permissions to my app or is it a tool to open those files?

How do the blocks have to look like? as an example? - i just want to have read access on all files under /Documents/fuehrerscheinpruefung

Read both threads carefully, find examples in the SAF thread, try something yourself and then come back with a screenshot of what you tried and your questions

Taifun

3 Likes

If your app is only intended for private use have a look also here How to request and grant MANAGE_EXTERNAL_STORAGE permission

1 Like

hey, thank you for your reply.

i tried this:

but seems not to work...

hi there, thank you for your reply,

i tried this:

but also not working, Permission denied.

I am going to use my app with assets now, seems working so far.

now i have one last problem. My app is in total about 45 MB, but appinventor can only make apps with max 30 MB.

Do i have any possibility to create my apk otherwise?

This runs well on android 11, but not with companion, you have to instal the apk

Awesome, thank you so much, this helps a lot!

hi there,

On Android 12 this is working, but unfortunately not on Android 13.

On A13 it is only asking for audio and video permissions, not for "edit all files".
in the end, my listviewer keeps empty.

any hint?

the activitystarter.action is set in the designer, so i did not add it here again.

Fahrerhandbuch4.aia (33.1 KB)

any idea someone?

As already said earlier, you have to use SAF
Taifun

You missed activity action here

fyi

Taifun

No, this does not work on any Android version > 10.

Try this one:

Blocks

Thank you very much, seems working so far in my dev environment. (just had to move the makedirectory block to somewhere else)

I will do the live testing next week.