Android - Dropbox: Check for differences

这一生的挚爱 提交于 2019-12-12 02:16:07

问题


Is it possible to check for differences between local and Dropbox?

Hello. I am currently working on a simple gallery App which displays all Dropbox images.

The workflow so far: I log into Dropbox. The App scans recursively through all Dropbox folders and checks for images, then takes the metadata and displays the images.

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).

Thank you in advance.


回答1:


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:

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. 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:

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

There are also corresponding methods if you're using an SDK. For example, in the Dropbox Java SDK for API v2, these are listFolder, listFolderContinue, and listFolderLongpoll, respectively.



来源:https://stackoverflow.com/questions/40044326/android-dropbox-check-for-differences

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