Android Drive Api Lock File while in use

烈酒焚心 提交于 2019-12-11 08:42:18

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!