3

I was using FCM to receive push notifications for implementing the firebase.

But when the user is logged out how can I clear the tokens. So that I stop getting notifications when the user is logged out.

Because I am saving tokens to firebase and backend is using them to send push messages.

Any advice. Thanks.

KENdi
  • 7,576
  • 2
  • 16
  • 31
user3804063
  • 809
  • 1
  • 14
  • 32
  • This [Handling Logout for FCM in Android post](https://stackoverflow.com/q/43193215/4625829) might be helpful (for the idea on how to tackle it). – AL. Jun 29 '17 at 11:46
  • 6
    There is no implicit connection between being signed in to Firebase Authentication and receiving messages through Firebase Cloud Messaging. That is intentional, since there are many apps where user need to receive messages without/before being signed in. I'd recommend clearing the token from your server if the user signs out, instead of trying to clear it from the device. But if you want to clear it from the device, AL.'s linked answer provides a good starting point. Also: https://firebase.google.com/docs/reference/ios/firebaseinstanceid/api/reference/Classes/FIRInstanceID#-deleteidwithhandler – Frank van Puffelen Jun 29 '17 at 15:20

0 Answers0