Multiple instances of Traccar running

Okoya Usman4 years ago

Thanks for this great project.

I noticed something, there is multiple running on Traccar in a scenario.
Let's say I open the Traccar app now, starts it, then I closed the app, it keeps running fine.
Then I reopen it, it seems to start another instance of tracking.
When I stopped it and check status log, the log recorded the stoppage, but still updating location after which means only one of the tracking service was stopped and the other is still running.
I tried to figure out and realized this issue might be caused by this code:

if (sharedPreferences.getBoolean(KEY_STATUS, false)) {
            startTrackingService(true, false);
}

which I believe is meant to make the traccar client start if it was on before.

I believe a solution is to make sure the tracking service is stopped before restarting.
Thanks!.

Anton Tananaev4 years ago

Please show logs where it starts twice.