Missed or untimely notifications with the cell phone blocked

controlsat3 years ago

Hi Anthony, I have a question:
I have verified in several ways, that when I block the cell phone after about 5 minutes, I no longer receive notifications from the app. I only receive them when unlocking the cell phone. On other occasions, when it is blocked, some notifications arrive but out of date.

I turned off battery saver.
I put all the necessary permissions so that it can work in the background.
I have tried with the official traccar app and with the modified app, the same thing happens.

It seems to me that perhaps it could be solved with some modification in the source code, so that it works permanently without interruptions.

What would I have to modify or add to the source code?

Anton Tananaev3 years ago

Anthony? Please avoid addressing your comments to specific person if you want help from the community.

controlsat3 years ago

sorry. I meant Anton. Please, could you tell me something about the previous message? I don't think it's only happening to me, I've tried on a samsung S20 and a samsung A72.

Anton Tananaev3 years ago

Notifications are delivered by Google services. We don't have any delays in the app.

AlexG8 months ago

I have same issue at S24 and Android 14, battery saver and for app and generally its off, all permissions given to the app, and i receive traccar notifications only when i unlock the phone as controlsat mentioned.

AlexG8 months ago

Anton, there are any differences at programming for geofence alarm notification and to other alarms at android at least?

As i found that when the phone its locked for a lot time only geofence alarm appeared, other alarms need to unlock the phone to arrive.

Anton Tananaev8 months ago

No difference. You're trying to look for a pattern where there is no pattern.

AlexG8 months ago

Yes im trying to find why not getting notifications of android Traccar when phones are locked

AlexG7 months ago

Hello Anton, may i ask as i found this topic with same issue :

https://stackoverflow.com/questions/36613692/gcm-push-notification-delay?rq=3

For Google services usage, to wake up locked device and appear notifications says to put in code priority =high

I don't know maybe you already done that to the android app, just asking maybe helping for all us we don't get traccar notifications when phone its locked or received with gcm delay 15-35 minutes because of the Google heartbeat

Anton Tananaev7 months ago

I don't think we set priority currently, so it's probably normal and not high.

AlexG7 months ago

Can you help me please on which file / row and how i can set it?
To test if issue will be resolved so to can including this to next official update.

Anton Tananaev7 months ago

Probably NotificatorFirebase is what you're looking for.

AlexG7 months ago

despite all those, i download from git the android manager, without change anything i build apk i install it and app notifications traccar not working. i need to do anything before build the app for working the app notifications?

tambiu2 months ago

Hi, Did you get push work withou delays ?

tambiu2 months ago

Hi AlexG

I have found, It needs to compile traccar source code, change file NotificatorFirebase.java

add the line

.setPriority(AndroidConfig.Priority.HIGH)

See my code

setAndroidConfig(AndroidConfig.builder()
                            .setPriority(AndroidConfig.Priority.HIGH)
                            .setNotification(AndroidNotification.builder()
                                    .setSound("default")
                                    .build())