B4A Library FirebaseStorage - Simple file storage backend

Status
Not open for further replies.

johndb

Active Member
Licensed User
Longtime User
I do not want to seem insistent, but how?
You cannot create top level folders within the app. These must be created in the FB dashboard as they require permissions to be set.
Folders below the defined top level folders will automatically be created when you upload files from the app and have a path defined.
 

Alpandino

Member
Licensed User
I can confirm this. In my app I'using this library and it works perfectly creating the needed folder if it doesn't exist. Anyway you can't delete folders. But this is a false problem.
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Fyi - call me stupid, but I struggled with this for quite a while before I realized that the "app id" that Erel referred to the rules is actually the Firebase Storage bucket ID, NOT the package name... DOH! It's probably spelled out very clearly somewhere, but I guess I missed it...

- Colin.
 

Claudio Oliveira

Active Member
Licensed User
Longtime User
I'm playing around with this lib and I just don't get to put it to work.
I can initialize the FirebaseStorage class successfully, but every single method called ends in error.
I'm trying to run this simple code:
B4X:
Starter.STORAGE.UploadFile(File.DirRootExternal,"text.txt",$"/public/test.txt"$)
And all I get is this:
B4X:
(IOException) java.io.IOException: The server has terminated the upload session

I've already checked everything out a zillion times, and everything is absolutely fine.
But I still don't get it working...

Any help would be highly appreciated!

By the way: The class name in the library is FilrebaseStorage

Regards

EDIT: SOLVED

I've changed the 2nd line of the rules from
B4X:
match /b/b4a-test1.appspot.com/o {
to
B4X:
match /b/{bucket}/o  {
and everything's OK now.

But it'd be a good idea fixing the class name on the lib's XML. I did that here.

Regards
 
Last edited:

zolive33

Active Member
Licensed User
Longtime User
Hello, is it possible to display download (or upload) progression?

Regards.
 

JEG

Member
Licensed User
Longtime User
Compiling either of the downloaded files in post 1 the following error arises. Where can the Json file be found?

 
Can you add timeout function, because some times users can not connect to Internet, we need check it because events completed will never fire without internet!!!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Always better to start a new thread for your questions.

Monitoring downloads: https://www.b4x.com/android/forum/t...load-or-upload-progression.86654/#post-548584

You can implement your own timeout mechanism with something like:
B4X:
Sub btnDownloadPublic_Click
    Dim path As String = "/user/test"
    Starter.storage.DownloadFile(path, File.DirInternal, "test")
    DownloadingPaths.Remove(path)
    Dim start As Long = DateTime.Now
    Do While DownloadingPaths.ContainsKey(path) = False Or DateTime.Now > start + 30 * DateTime.TicksPerSecond
        Sleep(500)
    Loop
    If DownloadingPaths.ContainsKey(path) = False Then
        Log("timeout reached")
    Else if False = DownloadingPaths.Get(path) Then
        Log("failed to download")
    Else
        Log("success")
    End If
End Sub


Sub Storage_DownloadCompleted (ServerPath As String, Success As Boolean)
    DownloadingPaths.Put(ServerPath, Success)
End Sub
DownloadingPaths is a global Map.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…