Firebase Notifications, does it take some time to work??

samaidha2 days ago

Good morning everyone,

I have set up Firebase notifications in Traccar (App version: 5.11). I configured the traccar.xml file and set up geofences in the web app. Below is the code I added to the configuration:

<entry key='notificator.types'>traccar, firebase</entry>
<entry key='notificator.traccar.key'>my_key</entry>
<entry key='notificator.firebase.serviceAccount'>
  {
    "type": "service_account",
    "project_id": "my_id",
    "private_key_id": "my_private_key",
    "private_key": "-----BEGIN PRIVATE KEY-----private_key\n-----END PRIVATE KEY-----\n",
    ...
  }
</entry>

The notifications are working fine from my Firebase console. However, when I test the notification channels in Traccar’s Settings > Notifications, the notifications are not being sent.

I came across a forum post (from this link: https://www.traccar.org/forums/topic/push-firebase-messaging-not-working/) where the user mentioned that it took around 2 hours for the notifications to work.

My question is: Does it usually take that long for notifications to be set up, or is there something wrong with my settings?

Thanks.

Anton Tananaev2 days ago

You should upgrade to the latest version.

samaidha2 days ago

Thanks for the quick reply
I have updated to 6.6, with the same configuration as above and with the db, the app works perfectly.

regarding my question.
does Notifications take some time to work?? or am i missing something in my configuration.
Settings > TEST CHANNELS not sending any notification to my custom app at the moment.

Anton Tananaev2 days ago

Normally it's instant or close to instant.

samaidha2 days ago

ok, guess something is not right from my end.

samaidha2 days ago

one more thing if i remove:

<entry key='notificator.types'>traccar</entry>
<entry key='notificator.traccar.key'>my_key</entry>

and restart, none of my device becomes online, is this a normal behaviour?

Anton Tananaev2 days ago

If you didn't remove notifications that use this channel, then it's expected.

samaidha2 days ago

Hi,

I have successfully implemented Firebase Notifications by manually adding my device's firebase.token to the Users > Attributes > Notification Tokens field in the Settings> Users. From the web interface

I'm using a custom app, The app will be used by multiple people on their respective devices, each with their own unique firebase.token. I wanted to ask if I need to handle and send the firebase.token to Traccar for storage whenever a new user signs in, or is there another method for managing this?

I'm asking this because there is only one user (admin) on the Traccar side and i do not want to create a user for every one who uses the custom app

Looking forward to your guidance.

Yes, you need a device token for each device.

samaidhaa day ago

Good morning.
Much thanks and appreciation to Traccar team,

i have a question regarding the User > Attributes > Notification Tokens field. it's currently a String type, but can it accept a list of Strings?

the idea is to update the Admin user's Notification Tokens attribute as follows:

  1. When a new device sends its FCM token.
  2. Add the new FCM token to the existing list of tokens.

This way, I wouldn't need to create a new user each time my custom app is installed on a new device.

Thank you for your help

Anton Tananaev21 hours ago

You can provide multiple comma separated tokens.

samaidha21 hours ago

Thank you very much for the quick response. That clarifies exactly what I was asking.