Today I learned how to send notifications from an Odoo (Python) backend to an Android app, using Firebase Cloud Messaging (FCM).
One part that had me going in circles for a while: device token.
A device token is basically a unique address for each app install on a phone. A server can’t just fire a notification at “everyone”, it has to know exactly which device the message is meant for, and that’s determined by this token. The token is generated on the Android side, then has to be sent and stored on the backend, usually tied to the logged-in user, so that when the server wants to send a notification, it just grabs the matching token.
Also just realized this token can change, it’s not generated once and used forever. So the backend needs a mechanism to update the token every time the app receives a new one from Firebase, not just store it once at the start.