Using Firebase Database and Firestore both at the same time - android

I have been reading a bit about Firestore and having a global Firebase Project, I'm of course interested in using Firestore.
Reading this firebase vs firestore page, at the bottom they say we can use both within the same App...
Well, that would be cool but wait...
What about Authentication?
Data Structure being different?
Storage?
With things being different between the two, how is it possible to use both at the same time within the same App?
I can't really picture it.
Cheers

Yes you can.
Actually each module have his method :
firebase.database() for database
firebase.firestore() for firestore
firebase.auth() for authentication
Etc...
And yes, database and firestore have different data structure

Related

Dashboard from Firestore data?

I have made a simple Android app with Flutter, that sends data to Firestore. Now, I need to build a dashboard that will be able to view the data. Excel doesn't work, I tried Zapier but it seems too limited, and I gave a look at Retool , but it seems to only work with RealTime database, not Firestore yet.
Would you guys be able to recommend something ?
Zapier does the job. I just had to name every row accordingly to the fields from firestore
Chartbrew.com supports connections to Firestore. You can run queries using Firestore operations and generate charts and tables to explore the data.

How to keep firebase realtime database in sync with firebase storage, the standard approch to this problem of two nested queries?

How to keep firebase realtime database in sync with firebase storage? I am trying to store images in firebase storage.
The current scenario
a POJO (which contain 3 images placeholder link) is saved in the realtime database.
Then the 3 images are uploaded in firebase storage and on successful upload the respected placeholder links in the realtime database are updated.
Now the problem is that sometimes when the user deletes the project in between the POJO is deleted from firebase but the links are still updated.
Is there a better way of doing this ? or is there any standard approch? Thankyou for your time.
There is not a standard approach to this, and it can't be solved by simple configuration. You will have to get creative and implement something that meets your specific needs.
One thing you can do is use Cloud Functions triggers to mirror and delete data between the two products, so that one data in one is added, modified, or deleted, that change is reflected in the other product. It would take at least two triggers, one database trigger, and one storage trigger, to make sure changes in either product are mirrored to the other product. You might also need some additional process to remove or correct invalid data periodically, if that is a concern.

How to configure Firestore end-points at run-time?

I have developed an Android APP based on Firestore for DB storing data.
Now I need that the user is able to configure on the APP at run-time the end-point of Firestore DB - these parameters are typically stored in google-services.json (firebase_url, project_id, storage_bucket)
How can these values be changed at run time? Is there a specific Android API to do this?
Thanks in advance for any suggestion/support on this matter :)
You will have to take control of the initialization of your app, rather than allow the default initialization. This is kind of complicated, and it involves calling FirebaseApp.initializeApp() correctly with the details of the project you're trying to access.
I've written a couple blogs about this:
https://firebase.googleblog.com/2016/12/how-does-firebase-initialize-on-android.html
https://firebase.googleblog.com/2017/03/take-control-of-your-firebase-init-on.html

Combining noSQL (Firebase) and SQL for an Android application

so I've finished making a full fledged Android application with which I store data and retrieve on Firebase Database.
However, since there are many joining statements (By using orderByChild and equalTo), the main home screen is very laggy.
The main reason why I'm using Firebase, is because it is a real-time database, however, there is only one screen where that is useful.
Do you think that it's a good idea to keep most of the data on an SQL database and only the data that requires real-time data transfers on Firebase, and will using SQL databases reduce the time it takes to load my home screen?
If you have a SQL background and you want to rewrite your application to use only Firebase, to have a better understanding, please take a look at this tutorial, The Firebase Database For SQL Developers. I asure you, Firebase will handle all your needs.
If don't have time to do this, than use Firebase just for the single activity that you need. If you think that in the future you'll need to make more than one section of your app to use Firebase, than think to change the whole app to use only Firebase.
Hope it helps.

Firebase online to Android offline datastore

I am building a mobile app to allow for real time messaging, befriending users, creating groups to both chat and share images with, as well as creating events where users can invite one another.
I have chosen to use Firebase as the online back-end. But, given Firebase uses a NoSQL data model, while Android SQLite uses SQL, when saving data offline in Android what is the conventional way to handle this? Is there a simple way to convert or simply save from NoSQL to SQL, or do I need to build a converter?
(This is especially important for the events, as once created, they must be scheduled in the AlamManager, giving users alerts upon event time)
While you could implement your own solution, truth is, you do not need to build anything from scratch.
There are free Android libraries which could help you. I would recommend you:
SimpleNoSQL
The transition from Firebase to SimpleNoSQL is pretty straight forward, and is mostly the same as if you were using any form of SQL:
1) You get the data from your remote db: you can get this trough a request to your remote server, it doesn't matter what language you are using as long as it can return a response you can catch.
2) You save said data to your local NoSQL db: once you have the information requested, it is up to you what to do with it. You could save it to a TXT file, a SQLite db, NoSQL db, save it to the SharedPreferences, etc.
Hope that helps.

Categories

Resources