You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
alinaybabenko
6 years agoNew member | Level 2
Dropbox Android SDK download File
Hello! I use Android SDK to create/upload/download file. I've found your example on github. It works okay. But I have a question about downloading of file. When I download file (not chane anything...
- 6 years ago
Can you clarify what 'result' is and where that's coming from? I don't see it getting set in the rest of your code.
Also, note that 'lastModified' isn't a method for getting file metadata from the Dropbox API. Perhaps you're referring to the downloaded local file? You may instead be looking for 'metadata.getClientModified' or 'metadata.getServerModified'.
Greg-DB
Dropbox Staff
Downloading a file shouldn't change the modified time. I just tried this and I can't reproduce that behavior.
Also, note that the API returns file metadata including fields named 'client_modified' and 'server_modified', not 'modified_date'. You can access them via 'getClientModified' and 'getServerModified' in the Dropbox Java SDK, respectively.
Can you share the version number of the Dropbox SDK you're using, and the full code to reproduce this? Thanks in advance!
alinaybabenko
6 years agoNew member | Level 2
I use
com.dropbox.core:dropbox-core-sdk:3.0.11
This is my code from DownlodingAsyncTask
FileMetadata metadata = (FileMetadata) mDbxClient.files().getMetadata("SOME_NAME");
File path = Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_DOWNLOADS);
File file = new File(path, metadata.getName());
// Download the file.
try (OutputStream outputStream = new FileOutputStream(file)) {
mDbxClient.files().download(metadata.getPathLower(), metadata.getRev())
.download(outputStream);
}
....
And when in Activity
result.lastModified() is NOW
Where am I wrong? Thank you in advance.
- Greg-DB6 years agoDropbox Staff
Can you clarify what 'result' is and where that's coming from? I don't see it getting set in the rest of your code.
Also, note that 'lastModified' isn't a method for getting file metadata from the Dropbox API. Perhaps you're referring to the downloaded local file? You may instead be looking for 'metadata.getClientModified' or 'metadata.getServerModified'.
- alinaybabenko6 years agoNew member | Level 2
Hello, Greg!
Thank you a lot. My mistake was that I didn't set time from metadata.getClientModified/metadata.getServerModified as you had said.
Thank you and have a nice day!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,915 PostsLatest Activity: 46 minutes agoIf you need more help you can view your support options (expected response time for an email or 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!