Firebase web push notifications - firebase

Hey guys I am using firebase push notifications in the web application, I am showing the notification via the service worker as mentioned in the firebase documentation.
the problem is when I open the browser , I see multiple push notifications stacked upon one another , as its very annoying to see many push notifications , is there any way to combine push notifications into one, based on some attribute.

As far as I know, you cannot group them. That is why many users tend to turn off notifications in their mobile devices because it is annoying. You have to follow the basic principles of push notifications.
It must be timely
It must be relevant to the users

Related

Does FCM support push notification to PWA on iPhone?

I host a PWA website and I am trying to integrate push notifications to my users who may have the website open in a browser tab even if their phones are inactive. You notoriously can't send Push notifications to iPhones without using Apple Push Notifications service (APNs).
Seeing as the point of firebase cloud messaging (FCM) is to outsource the message handlers, I kinda assumed it would support sending push notifications to iPhones somehow via APNs, but the information here suggests you still can't do this from the web.
https://firebase.google.com/docs/cloud-messaging/js/client
Safari and iPhones don't support Push API.
According to this answer: https://stackoverflow.com/a/64576541/2116253
Option #2 may be possible if you know the device ID token, which is apparently very hard to get and perhaps not possible anymore because Apple are trying to make it harder to obtain due to security concerns.
I think the actual sending via APNs from server side is quite easy, the problem comes with the initial setup/registration and actually granting permissions that allow notifications to arrive.
So, in short, I don't mind registering my website with Apple, agreeing to terms and obtaining keys for the purpose of interfacing with APNs, but I don't want to make and distribute a whole native iOS app just to send notifications to devices about my website.
Does anybody know the correct way to achieve this in 2022 ?

how can i send notification from flutter-web to flutter-application?

I had a project from two application(flutter application) and three flutter-web on the same firebase i want to send notification from the web to the application.
i searched alot for this and i cant find any answer or solution for this case.
I had a project from two application(flutter application) and three flutter-web on the same firebase i want to send notification from the web to the application.
i searched alot for this and i cant find any answer or solution for this case.
I hope you understand that we can't give you the finish solution here. I would recommend to you to go trough this docs.
What we can do is to explain it a little bit. For your solution I would recommend to use FCM. And how they work is that:
you use the Firebase SDK to receive a token from the client device.
you store that token on one of the Firebase databases
when sending a push notification to a device you would need to do it from the Firebase Cloud Functions and use that token to send the message to it. When you do that the device from witch the token is will get the message.
It doesn't matter what platform the device is (web, ios or android). All of them can receive Push Messages (in Web most of them but nor 100% all).
From your use case I would not recommend to use topics. You want to send messages from device to device and therefore the tokens are the best solution for it.

Ionic 4 & Firebase (FCM) - How to group push notifications

I'm using Firebase as my backend for my app (Ionic v4). On certain events, I notify the desired clients via Firebase Cloud Messaging. The problem is, it starts to get messy when there are lots of event occurring. I don't want to bombard the clients' devices. Therefore, I was looking for a way to "group" them to a single push notification (just like WhatsApp does).
I've heard about channels but looks like it's supported only on Android O and above. Plus, My device runs Android 7 and looks like WhatsApp can still group their messages, so I believe it's possible to achieve without channels.
I've heard about the tag property too. The problem with this property is that it's overriding the current notification with the same tag, instead of grouping the notifications.
Any solutions?
If you plan to send push notification to the group of topic, add this lines inside the platform ready.
this.fcm.subscribeToTopic('people');

Notification when app is closed in Ionic3

I am building my app using Ionic3 and Firebase. Here users can send eatch other messages. I want when a use sends a message to another ures he/she should get a notification in the phone even when the app is closed. I have no idea how to achieve this with Ionic3.
Any suggesions please.
I can see there are mainly 2 plugins for push notifications. cordova-plugin-firebase and cordova-plugin-fcm
At least I can fine some tutorial for cordova-plugin-fcm in the internet. There is no clear example of any wayout given for cordova-plugin-firebase.
You have to use the cordova-plugin-firebase and each time a user logs in using a device, a unique device ID will be registered with respect to that device. This device ID is used to send notifications. Make sure to handle this (device ID), every time a user logs in & logs out. If you do not remove the device_id from the database when a user logs out, he will continue to receive notifications.
You have to use a cordova-plugin for sending push notifications. One of the many available plugins is: cordova-plugin-firebase. This one is a good fit for Ionic 3 because there is an ionic-native wrapper available.
For sending the push notification you can use a third party service (there is also one offered by ionic) or you can send them yourself from your backend.

Does Ionic 2 support private & public Firebase notifications?

I'm thinking to work on firebase notifications in the last few days but I want to some answers for this few questions:
Does Ionic2 support firebase notifications ?
Will notification show in the top of screen when my application closed or it should be work in the background ?
Is firebase notification sent on time or it may take long time ?
If I assumed Ionic 2 can send private notifications (to my device only), so can I send public notification for all application users ?
If the answer of all questions "yes", wish you give me any useful links that may help me (if you have a time)
In addition to Gabriel's answer:
The default behavior for notifications is for it to show on the top part of the screen. I haven't worked on Ionic before, but AFAIK, the behavior should compared to Android.
With that said, you should refer to the Handling Messages part of the FCM docs.
There are factors to consider that may affect the time it takes for the device to receive a message, but as FCM's behavior, it would try it's best to send the message, as soon as feasible (see my answer here).
Gonna itemize this further:
Specific device only - Yup. When sending the message, just specify the registration token(s) that should recieve that message.
All devices - Yup. You could use the Firebase Notifications Console. But if you intend to send the message by using the REST API, you have to make sure that the devices are subscribed accordingly to your custom global topic.
About the device-to-device Gabriel mentioned, I think it should be worded as server to specific device(s).
Yes it does, and it works fine with FCM (Firebase Cloud Messaging, aka GCM - Google Cloud Messaging). It supports subscribing to topics and device-to-device notification via HTTP client. The topics subscriptions and device-to-device both require FCM plugin.
Yes, they'll appear on top of your device screen as any push notification, you'll just need to code how it'll behave after receiving it, like execute something if the notification is tapped, or do something if it's received and the app is already open (foreground), it's all up to you.
It's sent on time, i've never had delay problems, the longer it took to send the notification and i receive in my device was 10 seconds. But as far as i know it "stores" your notification for 24 hours, so if the servers go down or something happen the notification has a life time of 24 hours to be sent.
You can, as said in first answer, subscribe your users to topics. Let's say you want a topic to sent message so all users can receive, you can have an all topic, or have one only for logged users, one only for users who bought products, you can even get all users tokens and send one by one, but it's much better having them subscribe to topics.
Topics notifications can be sent via the Firebase project console. Device-to-device is sent by your app code.
To send device-to-device you'll need a token, it's provided by the FCM plugin (link above) and you'll need to store this token somewhere, like in your user node on Firebase. I usualy use the user device ID provided by the Device plugin to have his token, since the user can have multiple devices and log in all then, this'll prevent token overriding.
I don't know good tutorials about configuring FCM with Firebase, if i find something i'll edit the question and add it for you, but stick to the ionic native link and the FCM plugin github page.
Hope this helps.

Resources