Stop receiving messages when user logs out
I'm using Firebase Cloud Messaging (Android) along with this package for Laravel (in order to send messages to the apps).
When a user logs out of the app, I need to make it so they stop receiving messages from FCM.
I'm not exactly sure what the right way of doing this is though.
The Laravel FCM package (linked above) requires that each user has their Firebase token stored in the database (so that they can be sent messages by their token ID).
On logout, would I just delete the token from the database? What if the request fails (ie no internet connection, etc.)?
What if the user just uninstalls the app without first logging out? That would mean that the token would still exist in the database.
Or would I just delete the app's token by calling deleteToken()
? Would that be appropriate?
下一篇: 在用户注销时停止接收消息