Error when opening pdf

hello
i have probleme when i want opining pdf fils and show following notice
file://mnt/sdcard/AI/WooHoo.pdf exposed beyond app through Intent.getData()

it seems to be, you are trying this snippet App Inventor Code Snippets | Pura Vida Apps ...
which Android version are you using for your tests?
It seems to be, I have to adjust my snippet...

Taifun


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

nothing

but it works fine when I directly install the apk file in my phone and enable the storage permission.
but according to play store i can't enable this permission as the picture shows

which means, you have to use the AskForPermission method rom the Screen drawer and ask for android.permission.READ_EXTERNAL_STORAGE before using the snippet

let me know, if this works for you, so I can update the snippet

EDIT: another thing: your path from the screenshot will only work while working with the companion app or while using your development device, because the activity starter is not able to access the assets of your app...

therefore before using the activity starter you have to copy your file from the assets to another directory... the file extension can help you to copy the file..

I think, the best place would be to copy the file to the application specific directory, however this needs to be tested...
see also

Taifun

1 Like

Hi
sorry for the delay because I am a beginner in app inventor
I try all the solutions to open my pdf but nothing (copy the files before acttivitystarer and the permission read the storage too)

here is images
image
help me please

I now updated the example snippet here App Inventor Code Snippets | Pura Vida Apps

if you want to copy the pdf file from the assets into another directory, then you have to use the correct path for the assets and as well for the destination directory, see also the documentation of the Copy method of the file extension App Inventor Extensions: File | Pura Vida Apps

Copy file.
Use this method to copy small files, for large files use the CopyAsync method instead. Prefix the filename with / (i.e. relative path) to copy a file on the SD card. For instance /myFile.txt will copy the file /mnt/sdcard/myFile.txt. To copy assets packaged with an application (also works for the Companion) start the fromFilename with // (two slashes). However you can't copy files to the assets. If a fileName starts with file:/// you can specify a complete path to the file.

Taifun

1 Like

thank you :+1:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.