Can I intercept Firebase notifications before they are displayed in my user device ?

exaucae2 years ago

I have configured firebase notification with traccar 5.7. I want to intercepts Firebase notifications before they are displayed in my application.

After my setup, it turned out that no event was stored in my Google Cloud Firestore Messaging project.
Currently, it looks like traccar firebase notifications are sent to the user device directly, regardless of it being connected to the application or not.
It yields to questions:

  1. Where are firebase notifications sent by Traccar stored?
  2. If they stored somewhere, can my application retrieve those notifications before they are shown to the user?
Anton Tananaev2 years ago

We don't store them anywhere in Traccar. You can probably modify the code if you want to intercept them.

exaucae2 years ago

What do mean by modifying the code? Mine or Traccar?

Anton Tananaev2 years ago

Traccar.

exaucae2 years ago

Here's my thought process around the code modification.

We can have <entry key='notificator.firebase.mode'> property to set the notification mode. It would accept one of these message types:

Those mode names are subject to changes.

Consequently, NotificatorFirebase would use the right mode to send the Firebase message.

Should you have a concern, please let me know.
If that sounds like a plan, I'll draft a PR.

Anton Tananaev2 years ago

If you want to include it in the official version, I would create a GitHub ticket first to gauge the interest. And if people are interested, we can include it.

exaucae2 years ago

There it is: https://github.com/traccar/traccar/issues/5088
Meanwhile, I guess it'll be status quo.

Byhturka year ago

Additionally, it would be nice if we added a different notification sound category to the Alarms category in the iOS and Android apps.All notifications are in default category sound