B4A Library FirebaseStorage - Simple file storage backend

Status
Not open for further replies.

johndb

Active Member
Licensed User
Longtime User
I am using Firebase storage and it works like a charm. Is there a way of getting the timestamp of a particular file in storage?

Thanks,

John
 

inakigarm

Well-Known Member
Licensed User
Longtime User
B4X:
StorageMetadata.Timestamp
(returns Ticks from file's last update time) Prior you have to Dim a StorageMetadata Object
 

johndb

Active Member
Licensed User
Longtime User
B4X:
StorageMetadata.Timestamp
(returns Ticks from file's last update time) Prior you have to Dim a StorageMetadata Object
Thank you. I'm assuming that the StorageMetaData that you mention is returned in the event "Storage_MetadataCompleted (Metadata As StorageMetadata, Success As Boolean)" but how do I specify the "serverpath" in "storage.GetMetadata(serverpath as string)"?

[SOLVED] The server path is a string with the path of the file. I was attempting to prefix the actual path with the storage bucket and this is wrong. Simply specify a path. In this case it is a private folder so the path would be "/user/<user uid>/<filename>".
 
Last edited:

sunish

Member
Licensed User
Longtime User
I was trying the firebasestorage sample following the instructions. I put the json file obtained from console in the B4a folder. However I get an error "Error parsing manifest script:Line26, Word = C command expected." This prevents further compilation.

The corresponding line of the manifest file is
B4X:
CreateResourceFromFile("google-services", "google-services.json")


Sorry : Problem solved. I was accidentally using the previous version of B4A installed on the same machine.
 

sunish

Member
Licensed User
Longtime User
While trying the sample code, sign in doesn't seem to work.
I have enabled authentication in the console and am able to download the shared file in public folder, but google sign in button just results in "sending message to waiting queue (OnActivityResult)"
I get the prompt to select a google account, but nothing happens on pressing any of the Google accounts other than the above message.

I got cloud messaging to work and guess the creation of the json file etc is working fine as I can also download from the public folder, which implies the cloud storage url is set right.
 

sunish

Member
Licensed User
Longtime User

Okay found the problem, any kind of authentication requires a SHA1 fingerprint and will not work with default debug key
 

desof

Well-Known Member
Licensed User
Longtime User
Hi, I can connect but when I click on any of the buttons the application closes immediately.
What am I doing wrong ?

This is the detail of the log in Debug mode

 

trueboss323

Active Member
Licensed User
Longtime User
Will this work if I want to synchronize Statemanager settings from one phone to another? And which of the folder (auth, public, user) would this be best for? Or would the CloudKVS library be better?
 

freedom2000

Well-Known Member
Licensed User
Longtime User
Will this work if I want to synchronize Statemanager settings from one phone to another? And which of the folder (auth, public, user) would this be best for? Or would the CloudKVS library be better?
It does work to sync phones (statemanager or anything else)
You would better choose a non public folder...
 
Last edited:

trueboss323

Active Member
Licensed User
Longtime User
It does work to sync phones (statemanager or anything else)
You would better choose a non public folder...

Okay. In my case I want data and settings in my app to be synchronized across all devices. So if a user gets a new phone or something, then their settings will automatically be restored, or something like that.

My other question is if you able to modify their settings? Say a user emails you for help asking to change a score or setting for them , would you be able to do that?
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…