Do any features of Firebase Cloud messaging require a Firebase database? - firebase

I'm thinking about implementing Firebase Cloud Messaging without implementing a firebase database and it's unclear to me which features of FCM are supported without having a firebase database.
For instance, getting message delivery statistics (https://firebase.google.com/docs/cloud-messaging/understand-delivery) and sending notifications via the firebase console (https://firebase.google.com/docs/cloud-messaging/js/send-with-console). It doesn't explicitly say whether you need a firebase database in either of documents but I'd like to clear about that before implementing it.
So my question is, do you need a firebase database to send notifications via the firebase console or to view message delivery statistics? I know for the latter you need to implement google analytics. And also as a bonus, are there any firebase features that depend on having a firebase database?
Thank you

All FCM features are supported without having to use Realtime Database. They are completely separate products, and are only related as much as you want them to be in your app.

Related

Flutter Notifications with Firebase Realtime Database

I have a Flutter app integrated with a Firebase Realtime Database.
I want a notification (actually an alarm kind of thing if possible), when an item (lets call it alarm) in the database is set to "true". I always see firebase_messaging plugin for notifications, but I am not sure if I'm supposed to use this plugin despite that my app doesn't have anything to do with messaging.
I am totally new to both Flutter and Firebase, can you tell me how to listen to the database even if the app is not running?
By the way, I am currently building the app for only Android, but I want to build it for IOS too in the future.
Thanks.
You can use/write firebase cloud fucntion. Using firebase cloud function you can watch any document/field and try to write trigger logic like if a field is set to true then this cloud function will throw an notification via firebase messaging.
https://firebase.flutter.dev/docs/functions/overview/
When the user is not actively using the app there is no reliable way to continue to listen to changes in the Firebase Realtime Database. To notify the user of changes to the database in that situation, you'll need to listen for those change on an environment that is always on, and then send a message to the user through Firebase Cloud Messaging.
One environment that is always in is Cloud Functions, which is also part of Firebase, and allows you to run small snippets of JavaScript code on Google's servers in response to things that happen in your Firebase project. The documentation of Cloud Functions for Firebase as example of how to notify the user when something interesting happens in the database:
Developers can use Cloud Functions to keep users engaged and up to date with relevant information about an app. Consider, for example, an app that allows users to follow one another's activities in the app. Each time a user adds themselves as a follower of another user, a write occurs in the Realtime Database. Then this write event could trigger a function to create Firebase Cloud Messaging (FCM) notifications to let the appropriate users know that they have gained new followers.
The function triggers on writes to the Realtime Database path where followers are stored.
The function composes a message to send via FCM.
FCM sends the notification message to the user's device.
To review working code, see Send FCM notifications.

Flutter live notifications

I am using Firestore as a database for my flutter app. Some actions on my app lead to change/update in Firestore data.
I am using Flutter native notifications which are generated once a button is clicked. However, the data passed to the notification remains constant despite the data having been updated later in the Firestore.
I would like to implement a feature similar to the one present in sport apps where the live score is updated regularly in the notification.
How can I achieve that in my app? Do I have to use Firestore Cloud Messaging? Citing resources would be helpful.
What you want to achieve sounds like an ideal case for Firebase Cloud Messaging to be used. I recommend that you take a look at the FlutterFire documentation for Cloud Messaging both overview and usage, which should give you a good starting point.
Alternatively you can also use a Cloud Function as the host of FCM and only configure your app to receive messages, you can watch this video for insights on how to create the Cloud Function side.

for a company interested to use only Firestore, what is the differrence between gcloud and Firebase CLI

My straight question is: since I am not interested in other Google Services, only Firestore, what is the difference between Firebase Cli and gcloud? Can I do all I need only with Firebase Cli or should I learn also gcloud?
I can easilly see that gcloud can handle more services than Firebase Cli. Also I can see Firebase Cli remenber me a lot the purpose of npm+ng cli when working with NodeJs/Angular (a simple analogy about scaffold/initialize/deploy). Nevertheless, our company will only use Firestore to take advantage of its Realtime Database pushing events to our mobile application.
I use Firebase Cli to type in my Windows command line and create a project in Firebase. I can see the result in Firebase Console and I also can see it in Console Cloud Plataform.
For me, who is total beginner with Google Cloud Plataform, it is a bit confused when prefer one over other. For instance, let's say I want to query data from Firebase Crashlytics from command line instead of logging from my Browser. Is it possible to use either Firebase Cli or gcloud? If both, which one is recommended for some company only interested in Firestore project?
This week I am struggling to figure out how to extract metrics regard my Firestore project and if I don't know what is the recommended tool for reach this task it make even harder to find the first steps. By extracting I don't mean see a beatifull dash in Google Console. I mean consume an endpoint providing me Firestore Metrics or, even better, subscribe my endpoint to Firestore project which will be called every time some issue happens (Other question asking exactly about getting Firestore metrics)
It is confusing and is partly the result of Google's acquisition of Firebase, the creation of what's now called Firestore (which is the unification of the original Firebase backend technology and Google Cloud Datastore), and that Google provides the Firestore service to both its Firebase and Google Cloud developer audiences.
As you've gathered, Google Cloud's CLI (Cloud SDK aka gcloud) and the Firebase CLI overlap in functionality. However, importantly:
both CLIs interact with a shared set of Google services (e.g. Firestore, identity, logging etc.).
there are some Google Cloud services not part of Firebase and vice versa
If you're focused on Firebase, you should be to able to stick with the Firebase CLI and continue to interact with Google's services through this Firebase lens.
If you include Google Cloud Platform services that aren't part of Firebase, you'll need to then consider using gcloud but importantly, you can either:
continue to use the Firebase CLI for the Firebase services;
use gcloud to interact with some (not all!) of the Firebase services (e.g. Firestore).
Over time, I assume (!) the remain discord between these 2 platforms will diminish.
If you consider both platforms as the result of (an ongoing?) unification since the acquisition, hopefully, these discrepancies will be more understandable and less frustrating.
Where you do find inconsistencies and frustrations, ensure Google knows by submitting feature requests and bugs.

Is there any way to check how many read/write on Cloud Firestore via sdk?

Is there any way to check how many read/write on my app on Cloud Firestore?
There currently is no API to get the number of reads/writes from Cloud Firestore. Neither the client-side SDKs nor the server-side Admin SDKs expose this functionality.
The closest I can think of is something based on StackDriver monitoring that you can set up for Firestore. Based on that you can then wrap the StackDriver monitoring API in a custom end point (either in Cloud Functions or elsewhere).

Does Firebase create a topic when I subscribe to a non existing one?

I started working with Firebase in order to simplify the use of Push Notifications of my app. Searching around the Docs I found the possibility to send a notification to a group of devices through a topic which the devices are subscribed to.
My doubt comes out here. When I subscribe the devices (using firebaseToken) to the topic I want to use, does this topic creates implicitly if it's not created?
If it doesn't, when and how can I create a topic to use it later?
I'm using Firebase Cloud Store an Firebase Messaging.
You don't need to create a topic in order to use topic messaging. It just works the way you expect as long as the server and clients all agree on the name of the topic.
Firebase Cloud Messaging isn't related to Cloud Firestore in any way, other than that they are both Firebase products and are seen together in documentation and the console.

Resources