Thursday 19 November 2020

How to refresh the URI content obtained from the Storage Access Framework to point to the latest version

I have two separate devices both running KITKAT that have obtained a URI link to the same remote document (from Google Drive) at around the same time using the Android Storage Access Framework, using ACTION_OPEN_DOCUMENT while also taking persistable URI permissions.

Hereafter I perform a modification to the document from Device A (whereby I download, modify, save, and then re-upload back to the ContentProvider), but when I then re-download the document on Device B (in order to refresh it)(using the existing URI), I end up receiving the unmodified version of the document. On the side, using a desktop browser I have verified that the modification from Device A was successfully uploaded to the remote server.

How do I refresh and download the modified or in other words the latest document on Device B, using the existing URI link (the URI link that has existed on Device B since before the update)?

I see that there is a refresh() method callable from the ContentResolver, but this was only available since API 26, and I am not sure if this is what I am looking for.

Is there a proper way to refresh the document on Device B? I do not want that the Device B user is required to browse through the Picker again to obtain an updated URI to the latest version of the same document.



from How to refresh the URI content obtained from the Storage Access Framework to point to the latest version

No comments:

Post a Comment