Reputation: 411
I am trying to create a delivery app with push notifications to customers when changing of order status , my notification scenario is when customer place order I write some code to subscribe him to order topic (order id) to keep track the order status , the problem is what if the customer logged out from the app , the notifications that related to the orders is still active . what should I do in this situation ?
Upvotes: 0
Views: 524
Reputation: 510
First, you should not use topics to track a custom user notifications, use the fmcToken
instead.
When you sign in, get the token and then asign into the user:
FirebaseMessaging.instance.getToken();
And then you can send notifications to the user.
When you log out, you can:
FirebaseMessaging.instance.deleteToken();
Upvotes: 1