Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Associating Listener Result to Notification Sent #21

Open
tangjh opened this issue Jun 20, 2018 · 1 comment
Open

Associating Listener Result to Notification Sent #21

tangjh opened this issue Jun 20, 2018 · 1 comment

Comments

@tangjh
Copy link

tangjh commented Jun 20, 2018

Any idea how I can associate the listener result back to the notification sent?
Basically after sending multiple notifications, I want to find out how many success and failure for each of them.

@nicoqh
Copy link
Contributor

nicoqh commented Jul 2, 2018

Unfortunately, you can't identify the invalid/failing device token by looking at the event data.

Your app has to remember which device tokens the messages were sent to, and in what order they were provided.

Then you must compare the index (position) of the failing message with the index of the device tokens you provided. For example, let's say you send a message to tokens A, B and C. FCM responds with an array of successes and/or errors. If the first item in the result array is a failure, it means that the first token you provided -- token A -- failed.

Here's an article that explains it:
https://www.sentinelstand.com/article/device-group-management-with-firebase-cloud-messaging
(Specifically the section "The Legacy FCM HTTP protocol")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants