问题
I developing an iOS application that integrates with Firebase to deliver remote push notifications.
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?
回答1:
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.
来源:https://stackoverflow.com/questions/56969940/sending-firebase-push-notifications-to-logged-in-users-only