FileInfo.createdOn is 0

BackendlessCollection<FileInfo> fileInfos = Backendless.Files.listing("/media", "*.jpg", false, 100, 0);
while (fileInfos.getCurrentPage().size() > 0) {
 for (FileInfo fi : fileInfos.getCurrentPage()) {
 Date createdOn = new Date(fi.getCreatedOn());
 if(createdOn.after(lastSyncDate))
 downloadFile(fi);
 }
 fileInfos = fileInfos.nextPage();
}

I use this code but createdOn is 0. Can I fix this somehow?

BTW I tried to avoid this code by instead of comparing the file dates I tried to compare file sizes. Seems that the API returns as file size only multiples of 1024 bytes as file size. Is that correct?

Yes, this is correct. Our file system measures file space in the blocks of 1024 bytes.

That is unfortunate because that makes the possibility very high that a different file has the same file size. So I guess I am stuck with the createdOn value. I guess that is a bug it being 0.

Hi Juergen,

What’s your application ID?

The same file could certainly have the same file size.

I just tested with the latest build of the library and getCreatedOn() returns a valid value.

Mark

That is odd. It does not work for me. When listing the fileInfos I still have 0 in FileInfo.getCreatedOn().

Sorry, but I don’t feel comfortable sharing my AppId in a public forum.

Are you using the latest SDK? The most recent build is here: https://github.com/Backendless/Android-SDK/tree/master/out

Yes, I am using this version. I can see the file and its date in my browser, but when using the lib then createdOn is not set.

Please send your app id to support@backendless.com. I will try running a test program with that lib against your backend.

Do you see a correct timestamp on the developer’s console near the file?

Yes I do.

So the problem reproduces only via API, right?

Please, prepare the sample app (it may be only one class with main method in pure Java) which uses your application and reproduces the problem, because we can’t reproduce it on the other ones. You may send it to support@backendless.com in case you don’t want to share it here.

I sent an minimal example of my problem to support@backendless.com.

Thanks.

Hi Juergen,

The issue has been fixed. Please try it out in your app with the build of the library from here:

Regards,
Mark

It works now. Awesome. Thanks.