Winphone 8 GPS weirdness

52 Views Asked by At

I'm writing a POC for WinPhone 8 (I have a Nokia 928 running the 8.1 release).

One of the features I'm working with is GeoLocator and I'm noticing some odd behavior. My app gets your current location and then tracks your movement and calculates the distance between the two points. The odd behavior is that I'm sitting still and the PositionChanged event is firing! What gives? I've yet to move and my app already says the distance from the origin and my current location is ~9Meters.

Is this normal behavior for GPS? If so, what is the recommended method of dealing with it?

Here is how my GeoLocator is setup:

            _Geolocator = new Geolocator();
            _Geolocator.DesiredAccuracy = PositionAccuracy.High;
            _Geolocator.MovementThreshold = 5;
            _Geolocator.ReportInterval = 1000;

I have a button that gets the current location and starts the position changed event (chopping code for brevity):

        Geoposition position = await _Geolocator.GetGeopositionAsync();

        _trackLocation = true;
        _currentLocation = position;
        OrigLongitude = _currentLocation.Coordinate.Longitude;
        OrigLatitude = _currentLocation.Coordinate.Latitude;

        _Geolocator.PositionChanged += _Geolocator_PositionChanged;
        Message = "tracking location";

and the PositionChanged event:

            _currentLocation = args.Position; 

            //calculate the distance
            double d = _pointTracker.DistanceTo(_currentLocation.Coordinate.Latitude, _currentLocation.Coordinate.Longitude);
            double accuracy = _currentLocation.Coordinate.Accuracy;
            if (true == show.Contains("tracking X"))
            {
                show = "tracking Y " + accuracy.ToString();
            }
            else
            {
                show = "tracking X " + accuracy.ToString();
            }

            DispatcherHelper.CheckBeginInvokeOnUI(() => { Distance = d; }); 
            DispatcherHelper.CheckBeginInvokeOnUI(() => { Message = show; });
            DispatcherHelper.CheckBeginInvokeOnUI(() => { Longitude = _currentLocation.Coordinate.Longitude; });
            DispatcherHelper.CheckBeginInvokeOnUI(() => { Latitude =    _currentLocation.Coordinate.Latitude; });

The show junk just lets me see that a message showing that the event is firing. the only thing of interest in it is the GPS accuracy I'm getting back (usually it's about 3 meters, in doors it is 9 meters).

Any direction or help would be greatly appreciated. TIA

0

There are 0 best solutions below