我使用 C# 开发了一个 Windows 8.1 Store App,我想检测用户的当前位置。当我连接到 Wi-Fi 时,我获得了完美的位置,但是当我连接到 3G/4G 网络时,我根本无法获得当前位置,或者有时它会在位置附近给出。我正在使用以下代码来检测当前位置
geolocator = new Geolocator();
geolocator.DesiredAccuracy = PositionAccuracy.High;
geolocator.DesiredAccuracyInMeters = 1000;
geolocator.MovementThreshold = 100;
//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:"));
}
catch(Exception ex)
{
UserMessageUtil.ShowMessage("We are sorry, location services are unavailable.");
}
geolocator.PositionChanged += geolocator_PositionChanged;
有人可以建议,我做错了什么吗?是否有任何其他应用程序可以使用 3G/4G 网络查看当前位置?