Android Example [B4X] Supabase Storage - Download file with Progress

This is a very simple tutorial on how to download a file and show the progress in a progressbar.

Supabase Download with Progress.gif

With my small image there is not much progress, it makes more sense to use this function with larger files.
#If B4J
Private Sub xlbl_DownloadFile_MouseClicked (EventData As MouseEvent)
Private Sub xlbl_DownloadFile_Click
#End If
    Wait For (xSupabase.Storage.DownloadFileProgress("Avatar","test.png",Me,"DownloadProfileImage",xui.DefaultFolder).Execute) Complete (StorageFile As SupabaseStorageFile)
    If StorageFile.Error.Success Then
        Log($"File ${"test.jpg"} successfully downloaded "$)
        If File.Exists(xui.DefaultFolder,"test.png") Then File.Delete(xui.DefaultFolder,"test.png") 'Clean the download path, or do what ever you want
        Log("Error: " & StorageFile.Error.ErrorMessage)
    End If
End Sub

Private Sub DownloadProfileImage_RangeDownloadTracker(Tracker As SupabaseRangeDownloadTracker)
    If Tracker.CurrentLength > 0 Then
        Log($"$1.2{Tracker.CurrentLength / 1024 / 1024}MB / $1.2{Tracker.TotalLength / 1024 / 1024}MB"$)
        AnotherProgressBar1.Value = Tracker.CurrentLength / Tracker.TotalLength * 100
    End If
End Sub


  • Supabase Storage Progress
    11.9 KB · Views: 91