Missing Notifications

Christian5 years ago

Hi,
I'm using Traccar 4.8 and I encountered a problem with some notifications. Most of the time it works very well, but there're some users, that don't receive a notification. I created a notification for the event deviceOnline (notify always, via mail and firebase) and every user is connected with that notification and his/her device (visible in database). I checked the source code and I could locate the problem in method "NotificationManager:updateEvent." Inside of that method there is a for-loop which calls "getEffectiveNotifications" which normally returns the notification that is connected to the user. But sometimes it returns zero elements and I don't know why. I could track the error down to "getUserItems(userId)" inside "getEffectiveNotifications" which returns no element in the error case.

Can anyone tell me when the userItems are set or updated? Is it possible to refresh the userItems if I don't get the elements I expect?

Thanks for your help.

Anton Tananaev5 years ago

Why would it return no element if the user has notifications? Are you adding data to the database directly instead of using API?

Christian5 years ago

I think I found my mistake. I modified the "add user" function. At the creation of the user I linked him automatically to the notification. Afterwards I forgot to call Context.getNotificationManager().refreshUserItems().