aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/LocationProviderHandler.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-12-20 17:22:21 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2016-12-20 17:22:21 +1300
commit0a8d47bec2a232aad6353d34a101eb82c9d4f7ae (patch)
tree2bad0ed0875b4e2ef751ffc6a7d25591cd6ae3fd /src/org/traccar/LocationProviderHandler.java
parentc5594e16882ac3ec9215c47047e857566f8166b8 (diff)
downloadtrackermap-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.java8
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());
}