cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Dropbox Android SDK download File

Dropbox Android SDK download File

alinaybabenko
New member | Level 2
Go to solution

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 in it, just dowloading), I always have "modified_date" is NOW (not the date of last updating of file). Why does modified_date change even on downloading? 

 

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

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
New member | Level 2
Go to solution

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-DB
Dropbox Staff
Go to solution

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

alinaybabenko
New member | Level 2
Go to solution

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!

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    alinaybabenko New member | Level 2
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?