mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
check if location publishing to traccar enable or disabled
This commit is contained in:
parent
53f4fd7ebc
commit
9f6eaedbc3
@ -389,8 +389,10 @@ public class DeviceInformationManagerImpl implements DeviceInformationManager {
|
||||
|
||||
//Traccar update GPS Location
|
||||
try {
|
||||
DeviceManagementDataHolder.getInstance().getDeviceAPIClientService()
|
||||
.updateLocation(device, deviceLocation);
|
||||
if (HttpReportingUtil.isLocationPublishing()) {
|
||||
DeviceManagementDataHolder.getInstance().getDeviceAPIClientService()
|
||||
.updateLocation(device, deviceLocation);
|
||||
}
|
||||
} catch (TraccarConfigurationException 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 String IS_EVENT_PUBLISHING_ENABLED = "isEventPublishingEnabled";
|
||||
private static final String IS_LOCATION_PUBLISHING_ENABLED = "isLocationPublishingEnabled";
|
||||
|
||||
public static String getReportingHost() {
|
||||
return System.getProperty(DeviceManagementConstants.Report.REPORTING_EVENT_HOST);
|
||||
@ -62,4 +63,12 @@ public class HttpReportingUtil {
|
||||
}
|
||||
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…
Reference in New Issue
Block a user