【发布时间】:2016-05-07 07:50:00
【问题描述】:
我正在捕获 Listview_ItemTapped 上的纬度和经度,方法是使用 Geolocator 插件在 xamarin.forms 中获取 GPS 位置。
但捕捉位置平均需要 15 秒以上。有什么方法可以立即获取位置。
if (CrossGeolocator.Current.IsGeolocationEnabled == false)
{
await DisplayAlert("Notification", "Geolocation is Unavailable ", "Ok");
}
else
{
Application.Current.Properties["LATITUDE"] = null;
Application.Current.Properties["LONGITUDE"] = null;
var locator = CrossGeolocator.Current;
//locator.DesiredAccuracy = 50;
var position = await locator.GetPositionAsync(timeoutMilliseconds: 50000);
Application.Current.Properties["LATITUDE"] = position.Latitude;
Application.Current.Properties["LONGITUDE"] = position.Longitude;
await Navigation.PushAsync(new RetailerDetailsPage(), false);
}
我尝试删除locator.DesiredAccuracy = 50;,但有时它会立即工作,有时却不能。
【问题讨论】:
标签: xamarin navigation gps location xamarin.forms