I'm looking for ways to handle push notifications from PWA and Native apps.
We have both, and now when we send a push, I want that if user has installed both native and pwa on their mobile, to only receive the push from native, so we would avoid spamming the user with dublicate notifications. We are using Firebase for push notifications.
What are the best practices to handle this dublicate notification issue? I couldn't find any related info on the web.
This can only be achieved if the user is logged in. In this case you can store the user-identity together with the push notification token. Then on the server you can check which user has registered two notification tokens and send your message only to one token.
If your app does not provide any user identity, I see no way to achieve it.
But, are you sure this is the desired behavior?
Keep in mind that the user can have more than two tokens, for example if he uses your pwa on multiple devices/browsers.
Related
I am building an app like Messenger, everything works normally like sending messages, receiving messages, video calling. the technologies i use are react-native, reactJS, socket.io, nodeJS, react-native-webrtc
I wonder how can when I close an app like the messenger I can still receive incoming call notifications from other people. I'm studying firebase notification and react-native-background-timer but it doesn't seem to work the way I want it to
Has anyone had a problem like this and have an answer, please let me know
Have a nice day guys <3
In react native firebase there are two types of notifications "background" and "foreground".
Foreground Notifications:
A foreground service performs some operation that is noticeable to the user. For example, an audio app would use a foreground service to play an audio track. Foreground services must display a Notification. Foreground services continue running even when the user isn't interacting with the app.
When you use a foreground service, you must display a notification so that users are actively aware that the service is running. This notification cannot be dismissed unless the service is either stopped or removed from the foreground.
Background Notification:
A background service performs an operation that isn't directly noticed by the user. For example, if an app used a service to compact its storage, that would usually be a background service.
You want to follow there Documentation to apply push notifications in react native.
I am making a todo app with Javascript (PWA). There will be reminders for the todos. I want to send notifications to the user to remind them. Tasks and remind time will be stored in localStorage.
So now I want to send notifications without any backend. I have tried some tutorials, they all require a backend or Google push services for it.
Is there any way to send notifications without them?
I think the serviceWorker will have to keep running in the background and get the current time. Remind the user if current time and remind time matches.
So how to do it?
My app currently supports a chat function which is working only with Firebase Firestore, nothing else.
My idea is to implement a notification whenever a new message is received, the catch is: I want to get the notification even if the app is closed. (If you close Instagram or Whatsapp you also get notifications if somebody messages you, that's what I mean.)
The problem I face is that all Firebase listener work only as long as my app is connected to the Firebase servers but as soon as I close the app of course the app disconnects from the servers and so do the listeners not work anymore.
What I need is a function or a feature to track in the background if something on the Firebase Firestore has changed (in this case, if a new documents in a specific location was created) and if yes, trigger a notification, even if the app is closed.
Does anybody have an approach for me how I could accomplish this task?
You can use Firebase cloud messaging to solve this problem as whenever there is new data available to sync it checks with the client device status and updates it. Here you can find step by step guide on how to set it up.
I want to add browser notifications for my rails app.
I'm having trouble adding notifications to specific users.
For example, i have user and lesson models.
And I want to send notifications to the user about the beginning of the lesson.
But how do I send notifications, not to all users, but only to those related to the lesson?
The first thing you should do is to get and store the subscription object for each user. Then, in your application, you should send a notification only for related users.
There are a bunch of different gems for it, e.g. https://github.com/zaru/webpush
I am trying to integrate push notification in a web app(also PWA). I am using Mercure(https://symfony.com/doc/current/mercure.html) to send notification to users.
The webapp is made using Angularjs and PHP-symfony. I think for SSE the connection should remain open or re open every few seconds to send an event.
I don't know if it will work for PWA. Can I send a push notification using SSE to a PWA even when it's not open? If not, what should I use to send a push notification.
Should I use websockets? All the libraries for websockets I've seen create channels. And I don't know how to send a notification to a particular user in my database because in websocket, the only way to distinguish a user is a sessionId that's generated when they join the channel.
I will probably have to save the sessionId of the user in database when they login and join a common channel in the application and find sessionId of users I want to send a notification to and then send.
My question is, if I use SSE, can I send push notification when the webapp or PWA isn't open. Will websockets help? If yes, please give a suggestion on how I do what I want to do.