Is overwrite via ACTION_CREATE_DOCUMENT reliable, or do some pickers never allow it?


The docs say in one place that:

> ACTION_CREATE_DOCUMENT cannot overwrite an existing file. If your app tries to save a file with the same name, the system appends a number in parentheses at the end of the file name.

Somewhere else they say:

> The returned document may be a newly created document with no content, or it may be an existing document with the requested MIME type.

On the devices I have tried, the file picker allows overwrite. You cannot just confirm the same name in the field: that creates a new file (a duplicate with (n) in the name). But you can tap an existing file in the list, and then it offers to overwrite that file.

There is also an issue marked fixed, but it does not say how overwrite is supposed to work or on which pickers.

Can I assume that overwrite is reliable, or are there devices / file pickers that do not allow overwrite?

0
Sep 9 at 5:32 AM
User AvatarStefan
#android#android-intent#storage-access-framework#documents-provider

No answer found for this question yet.