Android Question Dropbox SDK V2 - Java: problem downloading

Tom Tran

Member
Licensed User
Hi,
I am using the Dropbox SDK V2 - Java and I can connect, list files, and even upload files. However, when I try to download a file, the file that I end up with is empty (0 bytes). I have tried several different files, all of them are small in size. Any ideas or suggestions?
Here is the download (and upload) code:
B4X:
Sub btnGetFile_Click
    dbxFiles.download("/Work/test.txt", File.DirDefaultExternal, "test.txt")
End Sub

Sub btnSendFile_Click
    dbxFiles.upload(File.DirDefaultExternal, "1.jpg", "/Work/" & "1.jpg", False, False)
End Sub

When the download is performed, in the log I get:
files.download()
files.download(after new File())
files.download(create fos)
files.download(fos created)
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Tom Tran

Member
Licensed User
Follow the Runtimepermissions tutorial.

So I followed the tutorial and I still have the exact same problem.
B4X:
    Dim testfolder As String = rp.GetSafeDirDefaultExternal("Save")
    File.WriteString(testfolder,"test.txt","aaa")
    dbxFiles.download("/work/temp.htm", testfolder, "Temp.htm")
The code above creates two files. File test.txt contains aaa and file Temp.htm is empty. On Dropbox, file Temp.htm is not empty.
Any other advice?
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
dropbox is case-insensitive, android is not. you're asking for trouble by the way you switch back and forth when naming files and folders and referencing them.
the log messages are generated by you; they'll say anything you tell them to say.
 
Upvote 0

Tom Tran

Member
Licensed User
dropbox is case-insensitive, android is not. you're asking for trouble by the way you switch back and forth when naming files and folders and referencing them.
the log messages are generated by you; they'll say anything you tell them to say.
Thank you for the input, but I have already tried several variations of capitalization since in different places within Dropbox, I can see things both all lower case and capitalizing the first letter of the directory and file and I get the exact same results every time.
 
Upvote 0

Tom Tran

Member
Licensed User
Upload a small project which shows the issue.

I´m pretty sure the library does work if setup correctly and correctly using Runtimepermissions.

So for an example, I slightly modified a copy of your DropboxV2Example1-Auth program.
 

Attachments

  • DropboxTest.zip
    11.7 KB · Views: 245
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Try this version and the new jar from Dropbox


As meta can be null you need to check....
B4X:
Sub dbxFiles_DownloadFinished(success As Boolean, meta As FileMetadata, error As String)
    If meta = Null Then
        Log($"dbxFiles_DownloadFinished(${success}, ${error})"$)
    Else
        Log($"dbxFiles_DownloadFinished(${success}, ${meta}, ${error})"$)
    End If
    If error.Contains("Exception") Then
        Log(LastException)
    End If

End Sub
 

Attachments

  • DropboxV2V0.47.zip
    112.1 KB · Views: 313
Upvote 0

Tom Tran

Member
Licensed User
Try this version and the new jar from Dropbox


As meta can be null you need to check....
B4X:
Sub dbxFiles_DownloadFinished(success As Boolean, meta As FileMetadata, error As String)
    If meta = Null Then
        Log($"dbxFiles_DownloadFinished(${success}, ${error})"$)
    Else
        Log($"dbxFiles_DownloadFinished(${success}, ${meta}, ${error})"$)
    End If
    If error.Contains("Exception") Then
        Log(LastException)
    End If

End Sub
Yes! That did it! Thank you very much!
 
Upvote 0

Sabotto

Active Member
Licensed User
I have the same problem. I downloaded version 3.1.4 of the library. But now in the library folder I have both 3.0.10 and 3.1.4. If I remove the 3.0.10, during compilation it asks me.
Do I have to keep them both?

And how can I test if the file "Temp1.htm" exists?

B4X:
dbxFiles.download("/MyFolder/Temp1.htm", testfolder, "Temp2.htm")

Because I believe it is not detected..
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Do I have to keep them both?
with the newest library version you only need the newest jar.
Only one of them is needed.
Because I believe it is not detected..
you need to get a filelist from the folder first to check which files are inside this folder.

I do not answer any more questions in this thread.
 
Upvote 0
Top