In my application I have original file on SD card, I create temporal file on SD card using DocumentFile, write some data there and finaly want to replace original file with temporal one. Using DocumentFile I'm deleting original file with delete() method of DocumentFile and then use method renameTo() of DocumentFile to rename my temporal file to original file. Both methods acomplished with result == true, but after this about 5-10 seconds i see old version of my original file in file browser. If I create simple File object based on file path of that replaced original file method length() returns for about 5-10 seconds length of it previous verion. This latency have appeared since Android M. In Android L there was no such problem. Are there any restrictions since Android M when working with DocumentFile leading to such effects?
Asked
Active
Viewed 246 times
1
-
Which devices inhibit the behavior so far? How is the document provider called? AFAIK, Samsung wrote their own implementation of external storage system, and other manufacturers can potentially do so as well. – user1643723 Mar 06 '17 at 17:03
-
DocumentFile is build based on URI to which user has granded write permission. I ask ContentResolver for persisted uri permissions, based on those uris I build so called root document. And then i use method findFile to get document I'm interested in. When document is found i work with that document. I dont use SAF intents to pick uri of interested document directly (app is file manager). Such behavior as in question i see on Sony z4 tablet Android 6.0.1 and Xiaomi Redmi 3s Android 6.0.1 – Andrey Kolesnikov Mar 07 '17 at 08:06
-
I'm experiencing a similar problem to this. Have you discovered anything new since your last comment @AndreyKolesnikov ? – Mark Oct 23 '18 at 08:34
-
Unfortunately, no. Not working on this project anymore. – Andrey Kolesnikov Nov 08 '18 at 12:08