Storage Access Framework - Cannot create file in cloud folder selected with ACTION_OPEN_DOCUMENT_TREE

Hello,
I am new to this forum. Please be patient if this is not the right sub-forum for this kind of thread.
I am an Android developer, I am testing Storage Access Framework with NextCloud+CloudFiles.
I opened a thread on StackOverflow but maybe here I can get real help on this specific topic. If the solution is found here I will put it also on StackOverflow for others to know.

My app uses the ACTION_OPEN_DOCUMENT_TREE intent to let the user select a cloud folder, and then wants to create a text file inside that folder but I see that an error occurs.
It has to do with

com.example.safevents W/DocumentsContract: Failed to create document
android.os.ParcelableException: java.io.FileNotFoundException: Failed to upload document with path /test/newfile.txt

Note that the folder uri is correctly retured and it has the read/write permissions.

df=DocumentFile.fromTreeUri(activity,uri);
DocumentFile df2= df.createFile("text/plain","newfile.txt");

in the snippet above df2 is null.

Is the above mentioned intent really supported? And are the SAF DocumentFile creation methods supported?
Thank you in advance

have moved this one to subcategory clients/android… hope that’s ok for you.

You could check the bug tracker for similar issues. Worst case, ask there again.

@Andy can you help?

@tflidd

there’s now a 2nd thread with the same problem… --> How to contact the official support?

development issues should be done via Github, “official” support means enterprise contracts with Nextcloud (as a company).

Beware that I am a community contributor, so that would be @tobiasKaminsky while for official business you would go through the companies channels.

@andy - i think it’s more question of developpers help here— not as much an official call for support :wink:

@Andy
This a sort of development question but on my side, not about the development of the Nextcloud platform.
I get an error as the DocumentProvider implementation is not working.
But I think this is a paramount function, so how can it be that it is not working?
Has nobody tested the main features that are intended to be implemented right now?

if the above does not work with Nextcloud Files App, please open up a bug report on github.
If it does work, you can maybe use it for comparison to see where your problem is?

(I am only here in help forum, if someone pings me, as it is otherwise too much additional work, which I cannot do… :/)

After some years I tried again using NextCloud to test my Android app SAF features.
I was enticed by a comment received recently on reddit about a similar topic.
And also I read some activity on this problem on the internet and someone saying it works or it is fixed.
(A similar issue on Google issue-tracker was dismissed as obsolete)
So,
I installed NC again on my phone and subscribed to the
https://ppp.woelkli.com/
service (it was automatically chosen based on my email address).

I have the same issue.

This time I noticed something:
the folder uri is in the form
content://org.nextcloud.documents/tree/random_alpha_numeric_chars
that is correct, because it is in the content provider format.

Then during the app use I get exceptions like:
java.io.FileNotFoundException: Failed to upload document with path
/path/folder/filename.ext
(please refer to the original post and SO question to understand what code causes the exception)

I wonder if this reveals something, that is, is the bug related to the path?
I mean, because it is written in a human readable form?
The path to the file is “correct” because it is just made with the folder names in the cloud provider space.
But I expected a content provider format.
It that something to investigate further? Maybe it was not accounted for before.
I do not know.
Can you give your opinions or suggestions about how to make this work?
Or what can I check?
Thanks in advance