问题
How can a DriveFile be locked for download while in use by a user?
In my case i have a database stored on Drive that needs to be synchronized locally (on the device). To do this, i have to download it and be sure that someone else is't writing on it concurrently before i upload it again.
I included the lib 'com.google.android.gms:play-services-drive:10.2.1'
.
Searching on internet i found the property labels.restricted
descripted:
Whether viewers and commenters are prevented from downloading, printing, and copying this file.
How do i change that with this Api?
How do i check if the file is locked?
If the internet connection fails, show i be worry about locking the file forever ?
回答1:
I don't think this is possible. Also, based from this old post, you can use the ETag of the file's entry to ensure that no one else has changed the file since it was fetched. This is not exactly the same thing, but it can achieve the same effect of ensuring that changes from one place are not overwritten by changes from another place. You should also file a feature request for this.
来源:https://stackoverflow.com/questions/43755723/android-drive-api-lock-file-while-in-use