From 1306899a67b28ad9cc0e6467291f3c8597df5479 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Tue, 16 May 2017 20:59:38 +1200 Subject: Update device status before event (fix #3165) --- src/org/traccar/database/ConnectionManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/traccar/database/ConnectionManager.java b/src/org/traccar/database/ConnectionManager.java index 9e4b65b2c..cfa8cc7a0 100644 --- a/src/org/traccar/database/ConnectionManager.java +++ b/src/org/traccar/database/ConnectionManager.java @@ -75,7 +75,10 @@ public class ConnectionManager { return; } - if (enableStatusEvents && !status.equals(device.getStatus())) { + String oldStatus = device.getStatus(); + device.setStatus(status); + + if (enableStatusEvents && !status.equals(oldStatus)) { String eventType; switch (status) { case Device.STATUS_ONLINE: @@ -93,7 +96,6 @@ public class ConnectionManager { Context.getNotificationManager().updateEvent(event, null); } } - device.setStatus(status); Timeout timeout = timeouts.remove(deviceId); if (timeout != null) { -- cgit v1.2.3