1

I would like to send notifications (or at least make them readable) only to users that are logged in on their devices. I could on each login and signout edit the realtime database and let the function that sends out notifications check it, but I was wondering if there was a simpler way to do this.

DaddyMike
  • 161
  • 11

1 Answers1

0

Firebase Cloud Messaging has no knowledge of users, so any time you want to relate messages to users you will have write code to do this. What you're describing is indeed a common way of doing this: write the token to a database when the user signs in, remove it from that database when they sign out.

Also see:

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807