仅向登录用户发送Firebase推送通知 [英] Sending Firebase Push Notifications to Logged-in Users Only
问题描述
我正在开发与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屋!