Trying to use the SAF Extension to read test.txt, but can't seem to read a text file I've inserted into the documents folder from another app. I'm using the SAF_CreateText File demo (thanks @ChrisWard ) with added button1 and button1 block shown. The demo app works as intended otherwise.
OK, Thanks! I've gotten to where I can create a folder, create a document, write to that document and read that document. Unfortunately, i can't open a similar document that wasn't created within the app and I seem to have to get permission to access the folder each time I open the app. I tried to use the following to take control automatically after storing the uri in a tinydb. Two questions, is there a way to give the app access to say the documents folder forever once it has been initially granted by the user? Can I open text files that were created outside of the app... ever? Thanks in advance!
Set permissions works, but isn't persistent if I restart the app.
Make File Works
Write File Works
Read File Works
Open Old Not sure if it works, but it appears to
Read Old "Permission Denial" must "obtain access using ACTION_OPEN_DOCUMENT or related APIs"
Anyone have any thoughts on that error?
Before looking at your more complex approach, are you able to read and write to a foreign txt file using the OpenDocument method I provided above, as a basic example ?
To get full access (on Android 11+) to all text files in /Documents that were not created by the app itself, copy all text files to the ASD via SAF, remove all text files in /Documents via SAF, and then copy or move all text files back to /Documents. After that, the app will have full access to these files without SAF (on Android 11+, of course, without READ / WRITE permission).