Bug? Bug in FirebaseStorage library

Ivan Aldaz

Member
Licensed User
Hi. It's a little typo, but has driven me almost crazy. Here it is:

When downloading a file with
B4X:
storage.DownloadFile(FirebaseStoragePath, localDir, "localFile")
the event sub raised is "storage_DownloadCompleteD", but if you want to "Wait for" the download to finish, you have to write:

B4X:
Wait for storage_DownloadComplete
without the 'd' at the end!

Best regards.
 

Ivan Aldaz

Member
Licensed User
Attached is the example requested. Note that works in both ways,
B4X:
Wait For Storage_DownloadComplete (ServerPath As String, Success As Boolean)
and
B4X:
Wait For Storage_DownloadComplete
You can try commenting and uncommenting lines

EDIT:

I've noticed that the thread doesn't return to the next line after "Wait For". If so, label1.text should be "Download complete"
 

Attachments

Last edited:

Erel

Administrator
Staff member
Licensed User
What is the output of this code:
B4X:
Sub btnDownload_Click
   Private fullPath As String = "/public/TestFile.txt"
   storage.DownloadFile(fullPath, File.DirInternal, "DownloadedTestFile.txt")
   Label1.Text = "  Waiting..."
   Wait for storage_DownloadComplete
   Log("Wait for storage_DownloadComplete")
End Sub


Sub storage_DownloadCompleted (ServerPath As String, Success As Boolean)
   Log("storage_DownloadCompleted")
End Sub
 

Ivan Aldaz

Member
Licensed User
It goes to the Sub storage_DownloadCompleted, but not to the next line after "WaitFor" ( Log("Wait for storage_DownloadComplete") ):

Logger connected to: HUAWEI ANE-LX1
--------- beginning of main
--------- beginning of system
Copying updated assets files (1)
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
storage_DownloadCompleted
 

Ivan Aldaz

Member
Licensed User
With the "d" at the end (Wait for storage_DownloadCompleted), the output is:

Logger connected to: HUAWEI ANE-LX1
--------- beginning of system
--------- beginning of main
** Activity (main) Pause, UserClosed = false **
** Service (starter) Destroy (ignored)**
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Wait for storage_DownloadComplete

...and the event "storage_DownloadCompleted" is not reached
 

Ivan Aldaz

Member
Licensed User
The FirebaseStorage.jar file date seen in post #12 is today's date (02.dec.18), it's the date the file you've uploaded in post #9 has when downloaded.

Would you mind trying my example in your PC, please? , or could anyone who read this thread try, please?
 

Ivan Aldaz

Member
Licensed User
Hi again.

I have been testing Uploading files and getting metadata, and the issue is exactly the same.

I've been messing around for a long time with this issue and at the end I have deleted the project in Firebase for creating a new one from zero (getting the same result), so the google-services.json file and the bucket name in the .zip file uploaded in post #3 are not valid anymore. I have uploaded a new file, in case someone still wants to try it. I have added code to make it easier to try uploading and getting metadata.
 

Attachments

Top