How can I connect firebase on my all-existing screen?

I'm currently working on a project for a shopping app. It's a basic shopping app where users can place orders, etc. I'm facing the challenge of connecting all existing screens to one database to retrieve and store data. In my case, I'm using Firebase as my database. My problem is how to connect all screens to the database and allow the system to retrieve data from Firebase and display data on the screens.

Additionally, one crucial aspect of this functionality is that users need to log in to their accounts. Once a user logs into their account, all the screens will retrieve the data associated with that account from Firebase to display what it has saved, such as the user's name, list of orders, and items in their cart. This functionality should ensure that data from other users is not displayed on the screen. For instance, Screen 1 should only display data relevant to the logged-in user's account and should not show data from other users.

Here you have a good guide:
METRIC RAT AI2 - Firebase with a Web Component

I've seen this but still confuse me since. I used the one that in experimental as my database so I can't follow it.

And which problem do you have with the firebase component?

Take a look here:

If you have you data stored in a similar way to this:
image

You can do something like this, to validate users and get the data from the logged user:


Then if you need that data in other screens you can pass it with blocks or you can use tinyDb to store it (or call again to firebase, for the user tag...).

Yes I did this. But my problem is how can I send those data that been save in firebase display in different screen. For example the username, and password. I want to display it to 3 different screen.

:point_up_2:

I mean yes. But how can I build that do I need to use "open another screen with value" ? Do I need to do this to each screen? Since when log in it will open the screen 2, do I need to use another "open another screen with value" to send the user data that been log in by user in different screen?

Like I have 6 different screen and to open that I need to use button. Do I need to use 5 open another screen with value to send the user data to each screen?

If you are going to need the same data in other 5 screen I think the better way is to use tinyDB, Store in first screen the data in tinyDB and then you will have that information available in the other screens.

Is that the only way? I can't use the firebase?

yes, you can do the same calls in all the screens you need the data...but it seems less efficient in terms of data consumption and network access.

And anyway, I suppose you will need to pass the userName from the first screen to the others...or are you going to request the userName in every screen?

I need to pass all the data that been save to all other screen then display what I need like name, then image if possible. but I think I will use the tinydb and won't continue the firebase since it's complicated since our prof still not showing us any advance project here in MIT.

Just wondering how can I see the data that been save in tinydb like in firebase?

But do you need a database where several user are registered with their usernames/passwords with some data? or do you have several initial parameters of the app user and then you have to pass that data to other screens?

If you need to register/store data from several users then firebase is a good option. Then recover the data for the user and store it in tinyDB to be available for all the screens.

If you only need to share the input data between screens, then tinyDB is enough.

Yes I need is save the username, pass, and other info of user like Facebook. And also store data like picture, and display it to another screen later thats what I need like a fully functional ordering system of restaurant or shopping app. What you recommend I use as db? Tinydb, firebase, or both?

So I can use both firebase and tinydb? Like when saving username, and other personal info, I can use firebase to store it, then use tinydb to store the image, video, review, etch. The I can combine the two of them? How?

Like you already have a system to register and login users in firebase, that is right....tinyDB can be used to, once you have recovered the info for one user, share that info between your different screens (you can store locally that info in your app, and then can be recovered from other screens).

Yes I ready build a system where I can register and log in using firebase, but how can I connect the two database? The tinydb and firebase? From what I interpreted to your replies, it's like I can use both db, like saving the username, password in firebase, then send the data that store in firebase to tinydb to help me display it to another screen. I am right? It confuse me a little sorry.

Following with the before example...once you have recovered the data for the user from firebase, you can store it in tinyDB and then, you can recover that data whenever and wherever you want in your app:

With StoreValue you are storing the recovered data from firebase into TinyDB.
With GetValue you are recovering the data stored in tinyDB. You can recover this data in other screens (you need to place a tinyDB component on each screen).

Maybe it would be necessary to take a look at this:
FAQ Section: TinyDB - Frequently Asked Questions - MIT App Inventor Community

Thanks I will do this.

Hell there. Sorry but when im doing this it's still confuse me how can I put that to my blocks

This is my blocks on my Sign-Up form, I'm not sure how can I implement the tinydb here.

And here my blocks for log in