[英]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.