简体   繁体   English

PWA +本机APP推送通知(Firebase)

[英]PWA + Native APP Push Notifications (Firebase)

I'm looking for ways to handle push notifications from PWA and Native apps. 我正在寻找处理来自PWA和本机应用程序的推送通知的方法。

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. 我们两者兼有,现在,当我们发送推送时,我希望如果用户在其移动设备上同时安装了native和pwa,则只接收来自native的推送,因此我们可以避免向用户发送重复的通知。 We are using Firebase for push notifications. 我们正在使用Firebase进行推送通知。

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. 请记住,用户可以拥有两个以上的令牌,例如,如果他在多个设备/浏览器上使用您的pwa。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未安装应用程序时 PWA 推送通知不起作用 - PWA push notifications not working when app is not installed ASP.Net MVC PWA 的推送通知 - Push Notifications for ASP.Net MVC PWA Firebase 功能推送通知 - Firebase Funtions push notifications PWA - 是否可以从 PWA 打开本机应用程序? - PWA - is it possible to open a native app from a PWA? 如何将 PWA 与 Next.js 集成以允许通知和推送通知 - How to integrate PWA with Next.js to allow for notifications and push notifications 有没有人使用 react-native-push-notification 和 firebase 云消息设置推送通知? [等候接听] - Has anyone setup Push notifications using react-native-push-notification and firebase cloud messaging? [on hold] 在 Firebase 云消息传递中,React 本机应用程序未通过 TOPIC 接收通知 - React native app not receiving notifications via TOPIC in Firebase cloud messaging Firebase:用于推送通知的Javascript SDK? - Firebase: Javascript SDK for push notifications? Firebase 推送通知在 Ionic 中不起作用 - Firebase push notifications are not working in Ionic Firebase推送通知 - 节点工作者 - Firebase push notifications - node worker
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM