aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/LocationProviderHandler.java
diff options
context:
space:
mode:
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());
}