Reputation: 1003
Im using push notifications to alert the user of some events, but when the user logout from the app, it should stop sending notifications to that device, but i cant check everytime i want to send any notification if the user is logged in or out in my database, is there any easy way to avoid sending the notification to an already loggedout user?
Upvotes: 0
Views: 981
Reputation: 125037
is there any easy way to avoid sending the notification to an already loggedout user?
Just have you app notify your server that the user has logged out. When the user logs in again, have your app tell the server that, too. Your server should keep track of which users are logged in and which aren't.
In other words, you should check whether the user is logged in or not before sending a notification, but checking should be easy because you should already have that information stored on your server.
Upvotes: 2