【发布时间】:2016-03-04 15:31:12
【问题描述】:
我正在使用 Windows 8.1 应用程序,我正在使用下面提到的代码查找用户的当前位置。现在,当我使用蜂窝网络在平板电脑中运行我的应用程序时,应用程序崩溃了,但它在 Wifi 上运行良好。有人可以为此提出解决方案吗?
geolocator = new Geolocator();
geolocator.DesiredAccuracy = PositionAccuracy.Default;
geolocator.DesiredAccuracyInMeters = 1000;
geolocator.MovementThreshold = 5;
geolocator.ReportInterval = 500;
try
{
Geoposition mygeoPosition = await geolocator.GetGeopositionAsync();
}
catch(UnauthorizedAccessException ex)
{
UserMessageUtil.ShowMessage("Location is disabled in Settings");
await Launcher.LaunchUriAsync(new Uri("ms-settings-location:"));
}
geolocator.PositionChanged += geolocator_PositionChanged;
我总是检查笔记本电脑,所以我过去没有遇到这个问题,但现在我有一台同时具有 3G 和 WIFI 连接的平板电脑,当我在平板电脑上运行应用程序并尝试获取当前位置时,错误来了.
更新
我有时也得到组或资源未处于正确状态以执行请求的操作。 (HRESULT 异常:0x8007139F) 在线错误
Geoposition mygeoPosition = await geolocator.GetGeopositionAsync();
当我连接到蜂窝网络
时,我遇到了这两个错误【问题讨论】:
标签: c# windows-8.1 bing-maps