GetGeopositionAsync()永远不会给出结果。 [英] GetGeopositionAsync() never giving results.

查看:85
本文介绍了GetGeopositionAsync()永远不会给出结果。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力弄清楚为什么在使用
GetGeopositionAsync()方法时,它似乎只是偶尔工作。有时它会工作得很好并且速度非常快,有时候它永远不会返回任何东西,没有错误,超时似乎也不起作用,它只是
永远不会完成。


 Geolocator geolocator = new Geolocator(); 
geolocator.DesiredAccuracyInMeters = 200;
geolocator.DesiredAccuracy = PositionAccuracy.Default;
Geoposition geoposition = await geolocator.GetGeopositionAsync(maximumAge:TimeSpan.FromMinutes(15),timeout:TimeSpan.FromSeconds(10));


代码从UI线程运行(虽然从BackgroundWorker运行似乎没有什么区别)。我完全失去了。我想我会回去使用

GeoCoordinateWatcher,至少可行。任何帮助将不胜感激。谢谢!

解决方案

您是否通过某些属性进行了调整以将阈值更改为更小?


如何订阅状态改变和位置改变的一些事件,而不是按照你现在的方式调用?


http://msdn.microsoft.com/en-us/library/windows/apps/windows .devices.geolocation.geolocator.aspx


I have been struggling to figure out why when using the GetGeopositionAsync() method, does it seem to only work sporadically. Sometimes it will work great and be super fast, other times it will just never return anything, no error and the timeout doesn't seem to work either, it just never completes.

 Geolocator geolocator = new Geolocator();
                geolocator.DesiredAccuracyInMeters = 200;
                geolocator.DesiredAccuracy = PositionAccuracy.Default;
Geoposition geoposition = await geolocator.GetGeopositionAsync(maximumAge: TimeSpan.FromMinutes(15), timeout: TimeSpan.FromSeconds(10));

The code is ran from the UI thread (although running from a BackgroundWorker did not seem to make a difference). I am at a complete loss. Im thinking I will just go back to use the

GeoCoordinateWatcher, at least that works. Any help will be greatly appreciated. Thank you!

解决方案

Have you tweated with some of the properties to change the threshold to be smaller?

what about subscribing to some of the events it has like status changed and position changed rather than calling with the way your are doing right now?

http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.geolocation.geolocator.aspx


这篇关于GetGeopositionAsync()永远不会给出结果。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆