then it would work like this:
it did not let me place the extraMineTypes block.
That parameter accepts a list.
Also, you will get uri from that event so there is absolutely no need to reassign the wrong value.
I'm sorry I'm not an expert, I don't understand very well where to put the file path.
as far as I understand, the OpenSingleDocument method lets you select a single document (in your case the pdf document)
OpenSingleDocument
Prompts user to select a single file
so what happens after using that method and selecting that file? which uri do you get in the GotUri event? that uri you have to use to for example display the pdf
Taifun
Thank you very much, now I understand!
This block configuration works. I can select a pdf file and I can see the uri in the label I have put. The problem I have now is when viewing the pdf. I pass the uri to activitystarter, it opens the pdf application, but does not open the file.
you can try to convert the uri into a filename and try that filename with the activity starter... my file extension offers the method GetFileName for this https://puravidaapps.com/file.php
in case that method does not work for you (because actually it was created to Get path and filename from media content uri), you also can use the corresponding method from the filetools extension by @vknow360 https://community.kodular.io/t/filetools-some-tools-to-work-with-files/40051
probably it would be nice to have such method in the SAF extension directly?
btw. to simplify your blocks you can move all blocks from the Button2.Click event into the GotUri event...
Taifun
Thank you Taifun,
I tried converting the uri to a file path with your extension and it didn't work, but it did work with Filetools as you told me.
Also reducing the blocks will work fine for me, just testing now, to see the label I put it like this.
Still, I can't get the pdfs to open with SAF. Maybe it's because of what @vknow360 was saying earlier. I don't know.
I am attaching the blocks for anyone if anyone sees any errors in them.
There is some misunderstanding, I guess.
You can't open any kind of file with SAF, you can only get access to files and read and write them.
Obviously you can render pdf files with Uri obtained from SAF with the help of extensions available in your own app.
I understand, I had been told that the problem of not being able to open pdfs was because of android 11 read/write permissions, and I thought that with SAF I could access this type of files with read permissions in this case.
So as you said here, now you are able to open pdf files with the help of external applications.
@vknow360 not exactly, what I was telling Taifun is that when I select the pdf file with SAF and get the Uri, I put it in the DataUri of ActivityStarter and it did not open the file. Then he suggested me to try to convert it to a normal path like file:///storage/emulated/0/... with its extension or with Filetools. And getting the path didn't work with TaifunFile and Filetools did (only the Uri to path), but even putting this path in the activitystarter DataUri still doesn't open pdfs (with android 11, this same thing on my tablet with android 8 opens pdfs without problems).
He has a similar problem:
But, unfortunately, I haven't checked anything till yet.
Yes it must be the same. I'm in no hurry, if one day it's available great!
Thank you very much anyway!
Hi Toni, I found a solution for my application. Hope this can help you.
All the best.
This only works because the PDF file is created (downloaded) by the app itself.
If the file has already been manually saved in this folder (/Download
) by yourself or by another app, this will not work.
Correct @Anke
I am also searching solution for opening a pdf file already stored in Documents folder.
Can the possible solution be -
to copy this file to ASD by using SAF extention by @vknow360 and then try opening it from ASD.?
Thank you @Clipper for the solution you share. I have tried it and it works!
but in my case I need to open pdfs that are in the internal storage of the mobile.
I understand, it is a different problem. Could it be fixed by having Activity Starter open a file explorer folder?
Hi Anke, you are right, it is a different problem.