简体   繁体   English

Android-Dropbox:检查差异

[英]Android - Dropbox: Check for differences

Is it possible to check for differences between local and Dropbox? 是否可以检查本地和Dropbox之间的差异?

Hello. 你好。 I am currently working on a simple gallery App which displays all Dropbox images. 我目前正在开发一个显示所有Dropbox图像的简单画廊应用程序。

The workflow so far: I log into Dropbox. 到目前为止的工作流程:我登录到Dropbox。 The App scans recursively through all Dropbox folders and checks for images, then takes the metadata and displays the images. 该应用程序以递归方式扫描所有Dropbox文件夹并检查图像,然后获取元数据并显示图像。

Now I want to know if it is possible to check for differences so the App does not need to run through all folders every time but only if something has changed (for example if new images have been added to a Dropbox folder). 现在,我想知道是否可以检查差异,因此该应用程序不必每次都在所有文件夹中运行,而仅在发生某些更改时(例如,将新图像添加到Dropbox文件夹中)。

Thank you in advance. 先感谢您。

The best way to keep track of changes in a Dropbox account when using the Dropbox API is by using /2/files/list_folder and /2/files/list_folder/continue: 在使用Dropbox API时,跟踪Dropbox帐户中更改的最好方法是使用/ 2 / files / list_folder和/ 2 / files / list_folder / continue:

https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-continue https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-continue

You should store the latest returned cursor, and then call back to /2/files/list_folder/continue using that cursor. 您应该存储最新返回的游标,然后使用该游标回调到/ 2 / files / list_folder / continue。 It will returned only the changes since you last called. 它将仅返回自您上次调用以来的更改。

For client-side apps, you can use /2/files/list_folder/longpoll to efficiently know when there are changes to retrieve: 对于客户端应用程序,您可以使用/ 2 / files / list_folder / longpoll来高效地知道何时需要检索更改:

https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-longpoll https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder-longpoll

There are also corresponding methods if you're using an SDK. 如果您使用的是SDK,则还有相应的方法。 For example, in the Dropbox Java SDK for API v2 , these are listFolder , listFolderContinue , and listFolderLongpoll , respectively. 例如,在用于API v2Dropbox Java SDK中 ,它们分别是listFolderlistFolderContinuelistFolderLongpoll

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM