Send push notification with FCM to specific users using serverside functions with api [closed] - firebase

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 days ago.
Improve this question
I'm pretty new to firebase so I wanted to create a android app using firebase and React Native. I want to make an app that notifies me when a product is on offer. I would use a TextInput where I can write down the product and sends it to the firestore database.
Now let's say there are multiple users and they wait for different products to get on offer, how do I handle that. I know if a user logs into the app using google or email they have a userID or something like that.
My idea would be a server function that uses a api to get the product that are on offer from the website and then maybe compares it to every user if any values match with the offer.
But how do I proceed after that, how do I send the push notification to this users?

Firebase Cloud Messaging push and deliver notification to the specified devices. You can push notifications through Firebase Console or Firebase Admin SDK.
You should use Firebase Admin SDK to push notifications when there're new offers depending on your business logic.

Related

Flutter Firebase: Should I use a server to send my users notifications? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I want to send my users notifications on a ToDo app that I made using Firebase Cloud Messaging. The idea is that users will store entries in Firestore that have a time field of when that entry is scheduled. At this time I want the user to get a notification.
During this time, I was wondering. Should I be running this code on a server or on the users devices? I am working on the users' device side so far but I imagine if I have a server, the server can check all users and see which ones have entries that need to be sent at a certain time.
So, should I make a server or can I use Firebase Cloud Messaging just on the app?
You should use Firebase Cloud Functions for this use case.
Cloud Functions for Firebase is a serverless framework that lets you
automatically run backend code in response to events triggered by
Firebase features and HTTPS requests.
https://firebase.google.com/docs/functions

How to disable/enable notification sound for your flutter application? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I want to disable sound for incoming notification when the user turn of the notification switch in my app.
I also read official documentation but couldn't find anything helpful.
Is there any way?
I tried This package for local notifications but didn't find what I am looking for!
This should be handled by your backend service. You can mute the sound by not sending "sound" key in your Cloud Messaging API. Read more here
One of the techniques can be deleting your old notification channel with sound and recreating the channel with no sound. This package is handy for dealing with notifications in flutter.
Delete Notification Channel
Create Notification Channel

is there a way to send notificatins automatically with firebase to flutter application [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I am developing a flutter application and I want to send notification to user if someone follows the user.I am using firebase and FCM to send notifications but I can only send them by hand.is there a way to send notification to user automatically when someone follows the user or etc. ?
Yes, you need to use the server side of Firebase Cloud Messaging, as explained in the doc:
The server side of Firebase Cloud Messaging consists of two
components:
The FCM backend provided by Google.
Your app server or other trusted server environment where your server logic runs, such as Cloud Functions for Firebase or other cloud
environments managed by Google.
Your app server or trusted server environment sends message requests
to the FCM backend, which then routes messages to client apps running
on users' devices.
The easiest solution is most probably to use Cloud Functions, unless you have your own server at hand.
There is an example for Cloud Functions in the official samples list: https://github.com/firebase/functions-samples/tree/master/fcm-notifications. The message sending is triggered by a new "record" in the Realtime Database but it is quite easy to adapt it to be triggered by Firestore documents creation.

Flutter firestore message notifications [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have implemented a chat app using cloud firestore.
The flow is like this:
There is a chats collection and it has both users ids saved. and chats collection has internal messages collection, where all the messages are saved.
both users can messages each other instantly.
Also any user can initiate chat with any other user.
What I want to know?
I want to send notification on the receiver mobile when a new message is sent. If anyone can understand the problem. Help will be appreciated <3.
Thanks.
I found this article that you might find useful, it is very detailed an even includes the code, basically the trick is to use Cloud Firebase Functions to listen any changes on the collection, in your specific use case, try to listen the onCreate trigger, that will be fired each time a user creates a new message (document) on the collection, more information on the Database Triggers can be found here
Then you only have to trigger the sendToDevice method from within the onCreate listener to push the message into the device.
Firebase cloud functions can be used to create and trigger functions according to your own business logic. I assume that you have configured and connected your flutter application with the firebase if not the below steps will guide you through that also.
This link here will guide you on how to start with cloud functions basically what all you need to do to set up the environment.
This link is a complete example which demonstrates on how to push notifications to a particular user device using the device token whenever a new document is added to a collection.
This is a youtube video for the above links.
Please go through the links and help yourself.

Can Google Firebase be considered a middleware? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I read that a middleware is a software/API/Cloud service that acts abstracting the usage of some functionality, for example, if I want a message to be sent from a client to a server, I could implement all the messaging API for myself or I could use a middleware where I could just create a client and a server and send a message following its protocol and the magic would be done behind the scenes.
With Firebase, this is kind of what happens, e.g. using Firebase database, I can tell it to store a certain string (from the client's part) and retrieve it (from the server's side), so to me it seems that Firebase acts as a middleware.
Is Google Firebase a middleware? If it is not, why?
Firebase isn't middleware. It's better classified as a platform as a service, or a backend as a service. There are lots of different products that make up the Firebase platform, and each one has its own way of providing services to mobile applications via SDKs.
Whether or not Firebase is classified as a "middleware" should be mostly irrelevant to developers. You just use SDKs to access backend services, and monitor them in the Firebase console. What goes on in the middle is an implementation detail.

Resources