Android Question FirebaseStorage / Storage.UploadFile

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I do
B4X:
                Wait for (CreateFirebaseStorage) Complete(storage As FirebaseStorage)
                storage.UploadFile(Path, FileName, $"/BBsViewer/${UpLoadID}.info"$)                                
                Wait For (storage) Storage_UploadCompleted(ServerPath As String, Success As Boolean)

For multiple files can I do a have to do a CreateFirebaseStorage each time? Do I have to wait for UploadCompleted for each file or can I do a

B4X:
                Wait for (CreateFirebaseStorage) Complete(storage As FirebaseStorage)

                storage.UploadFile(Path, FileName1, $"/BBsViewer/${UpLoadID}1.info"$)                
                storage.UploadFile(Path, FileName2, $"/BBsViewer/${UpLoadID}2.info"$)                
                storage.UploadFile(Path, FileName3, $"/BBsViewer/${UpLoadID}3.info"$)                
                
                Wait For (storage) Storage_UploadCompleted(ServerPath As String, Success As Boolean)

if I can't do multiple UploadFiles can I do
B4X:
                Wait for (CreateFirebaseStorage) Complete(storage As FirebaseStorage)

                storage.UploadFile(Path, FileName1, $"/BBsViewer/${UpLoadID}1.info"$)                
                Wait For (storage) Storage_UploadCompleted(ServerPath As String, Success As Boolean)

                storage.UploadFile(Path, FileName2, $"/BBsViewer/${UpLoadID}2.info"$)                
                Wait For (storage) Storage_UploadCompleted(ServerPath As String, Success As Boolean)

                storage.UploadFile(Path, FileName3, $"/BBsViewer/${UpLoadID}3.info"$)                                
                Wait For (storage) Storage_UploadCompleted(ServerPath As String, Success As Boolean)

Just confused if I need to do a createfilebasestorage before each file? and if I have to wait for each file.

CreateFirebaseStorage routine is below

B4X:
#Region CreateFirebaseStorage
Private    Sub CreateFirebaseStorage As ResumableSub
            LogColor($"${mClassName}::CreateFirebaseStorage"$,     Colors.Red)                
    
            Dim storage As FirebaseStorage    
            
            storage.Initialize("storage", mMyBucket)
    
            Sleep(250)
            
            Return storage
End Sub
#end Region
 

DonManfred

Expert
Licensed User
Longtime User
CreateFirebaseStorage each time?
No, only once at start.
You can run multiple uploads
B4X:
storage.UploadFile(Path, FileName1, $"/BBsViewer/${UpLoadID}1.info"$)
storage.UploadFile(Path, FileName2, $"/BBsViewer/${UpLoadID}2.info"$)
storage.UploadFile(Path, FileName3, $"/BBsViewer/${UpLoadID}3.info"$)

Make sure to have an eventsub to receive the Events when finished...
 
Last edited:
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Thanks. So instead of a
B4X:
                Wait For (storage) Storage_UploadCompleted(ServerPath As String, Success As Boolean)
I need to create a UploadCompleted routine
 
Upvote 0
Top