简体   繁体   English

如何实现连续准确的Windows Phone 8 GPS跟踪

[英]How to achieve continuous & accurate Windows phone 8 gps tracking

I tried to make an app that Continuously fetch location windows phone 8. 我试图制作一个可连续获取位置Windows Phone 8的应用。

The following code is used to fetch location. 以下代码用于获取位置。

                geolocator = new Geolocator();
                geolocator.DesiredAccuracyInMeters = 30;
                geolocator.ReportInterval = 15000;
                geolocator.StatusChanged += geolocator_StatusChanged;
                geolocator.PositionChanged += geolocator_PositionChanged;

When gps is getting normally everything work fine. 当gps正常恢复时,一切正常。

But Once the gps location is not availabile the Geolocator stops the location fetching.(That is when the device back to gps area the geolocator_PositionChanged not called) 但是一旦gps位置不可用,Geolocator就会停止位置提取(即当设备返回gps区域时,不会调用geolocator_PositionChanged)

I tried to to create a new geolocator object in geolocator_StatusChanged() as per this blog ( geoposition advanced tracking scenarios for windows phone 8 ) 我试图根据此博客geolocator_StatusChanged()创建一个新的geolocator对象geolocator_StatusChanged() Windows Phone 8的地理高级跟踪方案)

  case PositionStatus.NoData:
              geolocator = new Geolocator();
              geolocator.DesiredAccuracyInMeters = 30;
              geolocator.ReportInterval = 15000;
              geolocator.StatusChanged += geolocator_StatusChanged;
              geolocator.PositionChanged += geolocator_PositionChanged;

              status = "no data";
              break;

But it also not worked. 但这也行不通。 Please guid me how to ensure continues availabilty of gps data? 请指导我如何确保继续提供GPS数据?

Another point noticed that Once the gps source changed to Cellular it never come back to use the Satalite as gps source ( The cellular source returns least accurate gps values). 还有一点要注意的是,一旦gps来源更改为“蜂窝”,它将再也不会使用卫星卫星作为gps来源(蜂窝来源返回的准确度最低的gps值)。 So how i can specify the gps source in windows phone 8? 那么,如何在Windows Phone 8中指定GPS源?

Testing done on the device: Nokia lumia 520 在设备上完成的测试:诺基亚lumia 520

I have a fully working windows phone location client that I have tested out on the Lumia 520. Please test it out and let me know what you think: 我有一个可以正常运行的Windows Phone位置客户端,并且已经在Lumia 520上进行了测试。请对其进行测试,并让我知道您的想法:

https://github.com/nickfox/GpsTracker/tree/master/phoneClients/windowsPhone https://github.com/nickfox/GpsTracker/tree/master/phoneClients/windowsPhone

You shouldn't be as concerned with the location source as with the accuracy. 您不应该像位置准确性那样关注位置来源。 If a source is meeting your required accuracy (whether its gps, wifi or cell), who cares where it comes from. 如果信号源达到了您所要求的精度(无论是gps,wifi还是手机),谁在乎它的来源。 Test your location to make sure it meets your accuracy needs: 测试您的位置,以确保其满足您的准确性要求:

if (args.Position.Coordinate.Accuracy < 100.0) {
// do something with location
} 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM