-1

I'm new to Firebase and I decided to use it on an app I'm working on. I use a PHP script to send automated push notifications. To do that, I supply the recipient's registration token along with the message itself and send it to Firebase, which will then send the push notification to the target device.

What will happen if I send a push notification to an invalid token? I believe it will fail since there's no recipient but will I get penalized for it, especially when it happens multiple times? I did some research but found nothing that mentions it.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
Timidyo
  • 1
  • 2

1 Answers1

1

No it shouldn't punish you - for iOS at least, the APN tokens are sometimes changed (it's an Apple thing). On Android I haven't seen this issue. Whenever you make that request and it's an invalid token, it will let you know as a response to the request. You should have a response listener in your DB and if it tells you that token is invalid, you should just remove the token and have something within your application that sends it whenever the user opens it back up.

To reduce this problem, I always just send the token every time when the user launches my app

Kody R.
  • 2,430
  • 5
  • 22
  • 42