C# Windows Phone 8.1地理定位速度始终为5.8

C# Windows Phone 8.1地理定位速度始终为5.8,c#,windows-phone-8,gps,geolocation,windows-8.1,C#,Windows Phone 8,Gps,Geolocation,Windows 8.1,我使用地理位置和位置更改事件来获取设备位置的坐标 private async void StartGpsMonitoring() { if (locator == null) { locator = new Geolocator(); } if (locator.LocationStatus == PositionStatus.Disabled) {

我使用地理位置和位置更改事件来获取设备位置的坐标

       private async void StartGpsMonitoring()
    {
        if (locator == null)
        {
            locator = new Geolocator();

        }
        if (locator.LocationStatus == PositionStatus.Disabled)
        {
            //throw new Exception();

            MessageDialog noGpsDialog = new MessageDialog("Location services are disabled, please enable location services");
            noGpsDialog.Commands.Add(new UICommand("Location Settings", new UICommandInvokedHandler(this.CommandInvokedHandler), 0));
            noGpsDialog.Commands.Add(new UICommand("Cancel", new UICommandInvokedHandler(this.CommandInvokedHandler), 1));
            await noGpsDialog.ShowAsync();
        }
        if (locator != null)
        {
            //locator.MovementThreshold = 3;
            locator.ReportInterval = 1;
            locator.DesiredAccuracy = PositionAccuracy.High;
            locator.PositionChanged +=
                new TypedEventHandler<Geolocator,
                    PositionChangedEventArgs>(locator_PositionChanged);
        }
    }

       private async void locator_PositionChanged(Geolocator sender, PositionChangedEventArgs e)
    {
        string speed = string.Empty;
        await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
        {
            Geoposition geoPosition = e.Position;
            if (e.Position.Coordinate.Speed != null)
            {
                 speed = e.Position.Coordinate.Speed.Value.ToString(); // always 5.8
            }
            geolocation = geoPosition.Coordinate.Point.Position.Latitude.ToString() + " " +
                              geoPosition.Coordinate.Point.Position.Longitude.ToString() + "Speed = " +
                              speed;


            var textBlockStatus =
                ControlHelper.FindChildControl<TextBlock>(JourneyTrackerSection, "TextBlockStatus") as TextBlock;
            textBlockStatus.Text = geolocation;
        });
    }
private async void StartGpsMonitoring()
{
如果(定位器==null)
{
定位器=新的地理定位器();
}
if(locator.LocationStatus==PositionStatus.Disabled)
{
//抛出新异常();
MessageDialog noGpsDialog=新建MessageDialog(“位置服务已禁用,请启用位置服务”);
noGpsDialog.Commands.Add(新UICommand(“位置设置”,新UICommandInvokedHandler(this.CommandInvokedHandler),0));
noGpsDialog.Commands.Add(新UICommand(“取消”,新UICommandInvokedHandler(this.CommandInvokedHandler),1));
等待noGpsDialog.ShowAsync();
}
如果(定位器!=null)
{
//locator.MovementThreshold=3;
locator.ReportInterval=1;
locator.DesiredAccuracy=位置精度高;
定位器。位置已更改+=
新类型Deventhadler(定位器位置已更改);
}
}
专用异步无效定位器\u位置已更改(地理定位器发送方,位置更改发送方)
{
字符串速度=string.Empty;
wait dispatcher.RunAsync(CoreDispatcherPriority.Normal,()=>
{
地理位置地理位置=e.位置;
如果(e.Position.Coordinate.Speed!=null)
{
速度=e.Position.Coordinate.speed.Value.ToString();//始终为5.8
}
地理位置=地理位置、坐标、点、位置、纬度、ToString()+“”+
地理位置.坐标.点.位置.经度.ToString()+“速度=”+
速度
var文本块状态=
FindChildControl(JourneyTrackerSection,“TextBlockStatus”)作为TextBlock;
textBlockStatus.Text=地理位置;
});
}
我还试图得到速度值。但是,当使用模拟器时,无论模拟器上是否设置了速度限制/步行/骑自行车,我总是获得5.8,并且仍然从静态位置获得5.8

有人能解释一下原因吗?只是模拟器吗?如果我使用真实的设备,会得到准确的结果吗? 很难开发一个位置速度应用程序,每次我想调试/运行它的时候,我都必须运行它


非常感谢您的帮助。

我想我会发布一些详细信息,告诉您我已经找到了什么,以防将来有人遇到这种情况。看起来这是因为它正在模拟器上运行。设法遇到了一些关于使用地理定位代码的有限细节,以及一些特定于硬件的细节。在我设法找到一台windows phone进行测试后,模拟器无法达到这个速度。在实际设备上工作非常完美


这让微软非常恼火。这意味着每次我需要测试我的应用程序时,我都必须出去开车。渲染GPS模拟器完全无用

我想我会发布一些详细信息,以防将来有人遇到这个问题。看起来这是因为它正在模拟器上运行。设法遇到了一些关于使用地理定位代码的有限细节,以及一些特定于硬件的细节。在我设法找到一台windows phone进行测试后,模拟器无法达到这个速度。在实际设备上工作非常完美

这让微软非常恼火。这意味着每次我需要测试我的应用程序时,我都必须出去开车。渲染GPS模拟器完全无用