diff options
Diffstat (limited to 'src/org/traccar')
-rw-r--r-- | src/org/traccar/database/DataManager.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/org/traccar/database/DataManager.java b/src/org/traccar/database/DataManager.java index f5df1b84b..a530399c7 100644 --- a/src/org/traccar/database/DataManager.java +++ b/src/org/traccar/database/DataManager.java @@ -150,13 +150,18 @@ public class DataManager implements IdentityManager { if (force || System.currentTimeMillis() - devicesLastUpdate > dataRefreshDelay) { devicesById.clear(); devicesByUniqueId.clear(); + ConnectionManager connectionManager = Context.getConnectionManager(); + GeofenceManager geofenceManager = Context.getGeofenceManager(); for (Device device : getAllDevices()) { devicesById.put(device.getId(), device); devicesByUniqueId.put(device.getUniqueId(), device); - } - GeofenceManager geofenceManager = Context.getGeofenceManager(); - if (geofenceManager != null) { - geofenceManager.refresh(); + if (connectionManager != null && geofenceManager != null) { + Position lastPosition = Context.getConnectionManager().getLastPosition(device.getId()); + if (lastPosition != null) { + device.setGeofenceIds(Context.getGeofenceManager() + .getCurrentDeviceGeofences(lastPosition)); + } + } } devicesLastUpdate = System.currentTimeMillis(); } |