Notification Token

Cristian 3 years ago

Hello everyone

I'm configuring push notifications in traccar 5.5

I added the firebase service account configuration to the XML configuration file.

I deleted the notification token for an old user then logged into the app with that user so a new notification token was created and the app did it.

but when I try a notification in the firebase channel for that client I get the following error:

none of the tokens can be null or empty - IllegalArgumentException (... < NotificatorFirebase:91 < NotificationResource:96 < ...)

What am I missing?

Anton Tananaev 3 years ago

Are you sure there's no empty value separated by comma or something like that?

Cristian 3 years ago

I checked and the token contained no blanks.

I did the following:
1.- Login from the pc to Traccar.
2.- I deleted the user notification token and saved the changes.
3.- Exit Traccar and clear the history.
4.- Login again to Traccar and when reviewing the user's account there was the notification token attribute but it was blank. So I deleted it.
5.- Login from the app to create a new token and it was created.
6.- Login to Traccar from the pc to create a notification and I did the test from the test channel and the push notification arrived to the mobile phone.

As far as I could see the problem originated because when I deleted the user's notification token, there was still a blank one.

I had previously reviewed the solution proposed here https://github.com/traccar/traccar-web/commit/8dbfbcd6a5b7c9356c335debec28e70cd3952cb2

and verified that the changes were in my code and indeed they are.

Is this related to the problem I had?

Anton Tananaev 3 years ago

It could be related. Have you checked for commas?

Cristian 3 years ago

In the last token created there are no commas.
But in the tests I did, a very long token was created that did contain commas.

Anton Tananaev 3 years ago

It probably means it was several. Tokens are separated by commas. As long as there are no empty value before, after or in between, it should be fine.