I’m currently implementing push notifications and I got firebase set up etc. All working great so far, I love it. But I’m also quite new to all this. I understand that the token is bound to the user’s device where I first assumed it should be tied to the user’s account. How do you deal with logging out from the app and using a different device? Here’s what I’m thinking and I’d like to know if I got this right (we’re using a java backend btw):
- get token from expo and save it in the database for new user
- when the user logs out delete the token for that user from the database (and remove from Expo?)
- when the user logs back in/reinstalls app get a new token and store in the database
Also, if a user uses the app on multiple devices, should I store two tokens or use the same token for two devices? I have done some research but I can’t find a good answer to this. Some more insight would be much appreciated.
Thank you very much in advance!