【发布时间】:2015-07-08 05:38:19
【问题描述】:
我想在应用首次启动时获取当前位置。所以我在 App.xaml.cs 文件中添加了以下代码,但我面临的问题是获取位置需要花费大量时间。我认为发生这种情况是因为我没有允许或阻止位置跟踪的对话框。
var location=new Windows.Devices.Geolocation.Geolocator();
Geoposition pos=await location.GetGeopositionAsync();
GetLocation.Lat = pos.Coordinate.Point.Position.Latitude.ToString();
GetLocation.Long = pos.Coordinate.Point.Position.Longitude.ToString();
我在 App.xaml.cs 页面的 OnLaunched 事件中添加了上述代码,GetLocation 是我存储当前位置的类。
谁能提出可能是什么问题?
【问题讨论】:
-
有人可以提供帮助或建议其他方法吗?
标签: c# location windows-8.1