Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
I wonder if the following is the right way to detect remote changes in Java/Android using Core API v2:
ListFolderGetLatestCursorResult cursor = client.files().listFolderGetLatestCursor("");
ListFolderResult result = client.files().listFolderContinue(cursor.getCursor());
for (Metadata metadata : result.getEntries()) {
...
}
However I have not been able to detect remote folder changes with the above logic (if I use listFolder(), that works but it appears also the loop would visit every single file). Or should I keep cursor in persistent storage like SharePreferences?
Thanks in advance.
The equivalent of v1's getDelta (without a cursor) is listFolder, and the equivalent of getDelta (with a cursor) is listFolderContinue. Likewise, the equivalent of getDeltaLatestCursor is listFolderGetLatestCursor.
If you want the full state of the files in the account, you should start with listFolder (as opposed to listFolderGetLatestCursor) and continue on with listFolderContinue.
If you only want new changes, and don't care about existing items, then you can use listFolderGetLatestCursor and listFolderContinue.
In either case, you do need to store the last cursor you received (e.g., from listFolderContinue), and use that when calling back to listFolderContinue again. If you get the latest cursor from listFolderGetLatestCursor each time though, you won't see changes that occurred in the interim.
Thanks for the clarification.
It seems like in v1 /delta returned ANY new changes in the entire Dropbox, while in v2 it is only able to see a specified folder path. Am I not understanding something here?
I figured it out, thanks to this thread: https://www.dropboxforum.com/t5/API-support/list-folder-continue-Always-empty/td-p/164977 (Steve M.)
I forgot to send the recursive parameter.
🙂
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!