check if location publishing to traccar enable or disabled

feature/traccar-sync
Rushdi Mohamed 3 years ago
parent 53f4fd7ebc
commit 9f6eaedbc3

@ -389,8 +389,10 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager {
//Traccar update GPS Location //Traccar update GPS Location
try { try {
DeviceManagementDataHolder.getInstance().getDeviceAPIClientService() if (HttpReportingUtil.isLocationPublishing()) {
.updateLocation(device, deviceLocation); DeviceManagementDataHolder.getInstance().getDeviceAPIClientService()
.updateLocation(device, deviceLocation);
}
} catch (TraccarConfigurationException e) { } catch (TraccarConfigurationException e) {
log.error("Error on Traccar while adding GEO Location" + e); log.error("Error on Traccar while adding GEO Location" + e);
} }

@ -34,6 +34,7 @@ public class HttpReportingUtil {
private static final Log log = LogFactory.getLog(HttpReportingUtil.class); private static final Log log = LogFactory.getLog(HttpReportingUtil.class);
private static final String IS_EVENT_PUBLISHING_ENABLED = "isEventPublishingEnabled"; private static final String IS_EVENT_PUBLISHING_ENABLED = "isEventPublishingEnabled";
private static final String IS_LOCATION_PUBLISHING_ENABLED = "isLocationPublishingEnabled";
public static String getReportingHost() { public static String getReportingHost() {
return System.getProperty(DeviceManagementConstants.Report.REPORTING_EVENT_HOST); return System.getProperty(DeviceManagementConstants.Report.REPORTING_EVENT_HOST);
@ -62,4 +63,12 @@ public class HttpReportingUtil {
} }
return false; return false;
} }
public static boolean isLocationPublishing() {
Object configuration = DeviceManagerUtil.getConfiguration(IS_LOCATION_PUBLISHING_ENABLED);
if (configuration != null) {
return Boolean.valueOf(configuration.toString());
}
return false;
}
} }

Loading…
Cancel
Save