diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-20 17:22:21 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2016-12-20 17:22:21 +1300 |
commit | 0a8d47bec2a232aad6353d34a101eb82c9d4f7ae (patch) | |
tree | 2bad0ed0875b4e2ef751ffc6a7d25591cd6ae3fd /src/org/traccar/LocationProviderHandler.java | |
parent | c5594e16882ac3ec9215c47047e857566f8166b8 (diff) | |
download | trackermap-server-0a8d47bec2a232aad6353d34a101eb82c9d4f7ae.tar.gz trackermap-server-0a8d47bec2a232aad6353d34a101eb82c9d4f7ae.tar.bz2 trackermap-server-0a8d47bec2a232aad6353d34a101eb82c9d4f7ae.zip |
Improved network location providers
Diffstat (limited to 'src/org/traccar/LocationProviderHandler.java')
-rw-r--r-- | src/org/traccar/LocationProviderHandler.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/org/traccar/LocationProviderHandler.java b/src/org/traccar/LocationProviderHandler.java index d47f05bd1..5f07358ec 100644 --- a/src/org/traccar/LocationProviderHandler.java +++ b/src/org/traccar/LocationProviderHandler.java @@ -44,15 +44,17 @@ public class LocationProviderHandler implements ChannelUpstreamHandler { Object message = e.getMessage(); if (message instanceof Position) { final Position position = (Position) message; - if (position.getOutdated() || processInvalidPositions && !position.getValid()) { - locationProvider.getLocation(position.getAttributes(), new LocationProvider.LocationProviderCallback() { + if ((position.getOutdated() || processInvalidPositions && !position.getValid()) + && position.getNetwork() != null) { + locationProvider.getLocation(position.getNetwork(), new LocationProvider.LocationProviderCallback() { @Override - public void onSuccess(double latitude, double longitude) { + public void onSuccess(double latitude, double longitude, double accuracy) { position.set(Position.KEY_APPROXIMATE, true); position.setValid(true); position.setFixTime(position.getDeviceTime()); position.setLatitude(latitude); position.setLongitude(longitude); + position.setAccuracy(accuracy); Channels.fireMessageReceived(ctx, position, e.getRemoteAddress()); } |