I'm migrating to Firebase Cloud Messaging, and I have one doubt. My application must show the login screen when launching, and if the user performs login in another account, I must stop send notifications for the older user.
Using FCM, you can notify a client app that new email or other data is available to sync. You can send notification messages to drive user re-engagement and retention. For use cases such as instant messaging, a message can transfer a payload of up to 4000 bytes to a client app.
Reliability & Platform SupportIn 2022, Firebase Cloud Messaging and the Firebase Notification Composer experienced many major issues, with an average resolution time of 13 days. For almost 25% of the year, Firebase was having at least one major issue. Cloud Messaging issues history for 2022, YTD as of September 2022.
Firebase Cloud Messaging (FCM) provides a reliable and battery-efficient connection between your server and devices that allows you to deliver and receive messages and notifications on iOS, Android, and the web at no cost.
Using Firebase Cloud Messaging, we can send three types of messages, i.e., Notification Message, Data Message, and the message with both Notification & Data Payload.
Inside application You should renew Instance ID token and forget about the old one if You don't want to get notifications being sent to the old token. On every logout and login just take new Instance ID and update Your external database (in case Your application logic need it) with information about new token being assigned to that user :) There are no limits for generating new tokens and You cannot reuse once dropped tokens.
Renewing token is just calling getToken() again.
This is the best approach because InstanceID is in fact assigned to the "application instance" so in case of app reinstall on device or removing cache by user You'll have to get new token anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With