T Tom Tran Member Licensed User Jul 31, 2020 #1 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)
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 Jul 31, 2020 #2 Tom Tran said: Sub btnGetFile_Click dbxFiles.download("/Work/test.txt", File.DirDefaultExternal, "test.txt") End Sub Click to expand... Code with File.DirDefaultExternal = broken code. Runtime Permissions (Android 6.0+ Permissions) Upvote 0
Tom Tran said: Sub btnGetFile_Click dbxFiles.download("/Work/test.txt", File.DirDefaultExternal, "test.txt") End Sub Click to expand... Code with File.DirDefaultExternal = broken code. Runtime Permissions (Android 6.0+ Permissions)
T Tom Tran Member Licensed User Jul 31, 2020 #3 DonManfred said: Code with File.DirDefaultExternal = broken code. Runtime Permissions (Android 6.0+ Permissions) Click to expand... Thank you for the reply, but how do I fix it? I tried: B4X: dbxFiles.download("/work/temp.htm", rp.GetSafeDirDefaultExternal("") & "/Save", "Temp.htm") But that produced the same results (a 0 byte file). Upvote 0
DonManfred said: Code with File.DirDefaultExternal = broken code. Runtime Permissions (Android 6.0+ Permissions) Click to expand... Thank you for the reply, but how do I fix it? I tried: B4X: dbxFiles.download("/work/temp.htm", rp.GetSafeDirDefaultExternal("") & "/Save", "Temp.htm") But that produced the same results (a 0 byte file).
DonManfred Expert Licensed User Longtime User Jul 31, 2020 #4 Follow the Runtimepermissions tutorial. Upvote 0
T Tom Tran Member Licensed User Jul 31, 2020 #5 DonManfred said: Follow the Runtimepermissions tutorial. Click to expand... 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
DonManfred said: Follow the Runtimepermissions tutorial. Click to expand... 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?
drgottjr Expert Licensed User Longtime User Aug 1, 2020 #6 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
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.
T Tom Tran Member Licensed User Aug 1, 2020 #7 drgottjr said: 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. Click to expand... 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
drgottjr said: 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. Click to expand... 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.
DonManfred Expert Licensed User Longtime User Aug 1, 2020 #8 Upload a small project which shows the issue. I´m pretty sure the library does work if setup correctly and correctly using Runtimepermissions. Upvote 0
Upload a small project which shows the issue. I´m pretty sure the library does work if setup correctly and correctly using Runtimepermissions.
T Tom Tran Member Licensed User Aug 1, 2020 #9 DonManfred said: Upload a small project which shows the issue. I´m pretty sure the library does work if setup correctly and correctly using Runtimepermissions. Click to expand... So for an example, I slightly modified a copy of your DropboxV2Example1-Auth program. Attachments DropboxTest.zip DropboxTest.zip 11.7 KB · Views: 619 Upvote 0
DonManfred said: Upload a small project which shows the issue. I´m pretty sure the library does work if setup correctly and correctly using Runtimepermissions. Click to expand... So for an example, I slightly modified a copy of your DropboxV2Example1-Auth program.
DonManfred Expert Licensed User Longtime User Aug 1, 2020 #10 Try using try catch for the download. It may reveal more info B4X: Try dbxFiles.download("/Work/Temp.htm", testfolder, "Temp.htm") Catch Log(LastException) End Try Upvote 0
Try using try catch for the download. It may reveal more info B4X: Try dbxFiles.download("/Work/Temp.htm", testfolder, "Temp.htm") Catch Log(LastException) End Try
T Tom Tran Member Licensed User Aug 1, 2020 #11 DonManfred said: Try using try catch for the download. It may reveal more info B4X: Try dbxFiles.download("/Work/Temp.htm", testfolder, "Temp.htm") Catch Log(LastException) End Try Click to expand... Nothing was added to the log, so I suppose that no exception occurred. Upvote 0
DonManfred said: Try using try catch for the download. It may reveal more info B4X: Try dbxFiles.download("/Work/Temp.htm", testfolder, "Temp.htm") Catch Log(LastException) End Try Click to expand... Nothing was added to the log, so I suppose that no exception occurred.
DonManfred Expert Licensed User Longtime User Aug 1, 2020 #12 Try this version and the new jar from Dropbox Maven Repository: com.dropbox.core » dropbox-core-sdk » 3.1.4 mvnrepository.com 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 DropboxV2V0.47.zip 112.1 KB · Views: 766 Upvote 0
Try this version and the new jar from Dropbox Maven Repository: com.dropbox.core » dropbox-core-sdk » 3.1.4 mvnrepository.com 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
T Tom Tran Member Licensed User Aug 1, 2020 #13 DonManfred said: Try this version and the new jar from Dropbox Maven Repository: com.dropbox.core » dropbox-core-sdk » 3.1.4 mvnrepository.com 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 Click to expand... Yes! That did it! Thank you very much! Upvote 0
DonManfred said: Try this version and the new jar from Dropbox Maven Repository: com.dropbox.core » dropbox-core-sdk » 3.1.4 mvnrepository.com 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 Click to expand... Yes! That did it! Thank you very much!
Sabotto Well-Known Member Licensed User Aug 5, 2020 #14 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
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..
DonManfred Expert Licensed User Longtime User Aug 5, 2020 #15 Sabotto said: Do I have to keep them both? Click to expand... with the newest library version you only need the newest jar. Only one of them is needed. Sabotto said: Because I believe it is not detected.. Click to expand... 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
Sabotto said: Do I have to keep them both? Click to expand... with the newest library version you only need the newest jar. Only one of them is needed. Sabotto said: Because I believe it is not detected.. Click to expand... 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.
Sabotto Well-Known Member Licensed User Aug 5, 2020 #16 Ok. Solved. hadn't used the version 0.47 but the 0.44. Thanks Upvote 0