diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/org/traccar/database/DeviceManager.java | 1 | ||||
-rw-r--r-- | src/org/traccar/model/Device.java | 6 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/org/traccar/database/DeviceManager.java b/src/org/traccar/database/DeviceManager.java index a6caf0e47..ae5784b01 100644 --- a/src/org/traccar/database/DeviceManager.java +++ b/src/org/traccar/database/DeviceManager.java @@ -202,7 +202,6 @@ public class DeviceManager implements IdentityManager { public void addDevice(Device device) throws SQLException { dataManager.addDevice(device); - device.setStatus(Device.STATUS_OFFLINE); devicesById.put(device.getId(), device); devicesByUniqueId.put(device.getUniqueId(), device); if (device.getPhone() != null && !device.getPhone().isEmpty()) { diff --git a/src/org/traccar/model/Device.java b/src/org/traccar/model/Device.java index 22426c4db..4c02481ca 100644 --- a/src/org/traccar/model/Device.java +++ b/src/org/traccar/model/Device.java @@ -51,7 +51,11 @@ public class Device extends Extensible { } public void setStatus(String status) { - this.status = status; + if (STATUS_ONLINE.equals(status) || STATUS_UNKNOWN.equals(status)) { + this.status = status; + } else { + this.status = STATUS_OFFLINE; + } } private Date lastUpdate; |