Ad

Sending Firebase Push Notifications To Logged-in Users Only

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?

Ad

Answer

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.

Ad
source: stackoverflow.com
Ad