仅向登录用户发送 Firebase 推送通知 [英] Sending Firebase Push Notifications to Logged-in Users Only

查看:35
本文介绍了仅向登录用户发送 Firebase 推送通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个与 Firebase 集成以提供远程推送通知的 iOS 应用.

I developing an iOS application that integrates with Firebase to deliver remote push notifications.

该应用程序包含登录功能,即使用户未登录,使用 FCM 令牌 发送通知也会发送通知,我明白为什么会发生这种情况,因为 FCM 令牌是一个应用程序- 设备组合不是应用程序用户组合.

The application includes a login feature, and sending a notification using the FCM token sends it even though the user is not logged-in, and I get why that happened because the FCM token is an app-device combination not an app-user combination.

但是是否有一种解决方法可以保证仅在用户登录时才发送通知?

But is there a workaround to guarantee that the notification is only delivered when the user is logged-in?

推荐答案

推送通知与用户状态无关.如果可以,您应该跟踪服务器上的用户状态,例如检查登录令牌,以检查用户是否已登录.但我认为你不能完全确定用户状态.

Push notification are not linked with user status. If you can, you should track user state on your server, checking a login token for example, to check if the user is logged in or not. But i think that you can't be completely sure for the user state.

这篇关于仅向登录用户发送 Firebase 推送通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆