Android Question [FirebaseStorage] Display download (or upload) progression

Erel

B4X founder
Staff member
Licensed User
Longtime User
Code that downloads a file and monitors the progress:
B4X:
Sub btnDownloadPublic_Click
   Dim cs As CountingOutputStream 'RandomAccessFile library
   cs.Initialize(File.OpenOutput(File.DirInternal, "1.png", False))
   Starter.storage.DownloadStream("/public/Untitled.png", cs)
   Dim stop() As Boolean = Array As Boolean(False)
   MonitorDownload(cs, stop)
   Wait For Storage_DownloadCompleted (ServerPath As String, Success As Boolean)
   stop(0) = True
   If Success Then
     Log("download successfully")
   End If
End Sub

Sub MonitorDownload(cs As CountingOutputStream, stop() As Boolean)
   Do While stop(0) = False
     Sleep(200)
     Log(cs.Count) '<-----
   Loop
End Sub
 
Upvote 0
Top