【发布时间】:2021-02-11 01:25:14
【问题描述】:
我尝试在位置变化时听,应用程序检测到它。 在android上运行良好,但在ios上却不行 我关注了这个:https://docs.microsoft.com/en-us/xamarin/essentials/geolocation?tabs=ios
async Task StartListening()
{
await DisplayAlert("1", "moving", "OK");
await CrossGeolocator.Current.StartListeningAsync(TimeSpan.FromSeconds(5), 10, true, new Plugin.Geolocator.Abstractions.ListenerSettings
{
ActivityType = Plugin.Geolocator.Abstractions.ActivityType.AutomotiveNavigation,
AllowBackgroundUpdates = true,
DeferLocationUpdates = true,
DeferralDistanceMeters = 1,
DeferralTime = TimeSpan.FromSeconds(1),
ListenForSignificantChanges = true,
PauseLocationUpdatesAutomatically = false
});
await DisplayAlert("2", "moving", "OK");
CrossGeolocator.Current.PositionChanged += PositionChangedAsync;
}
第一个警报有效,但第二个无效。 需要帮助
【问题讨论】:
标签: ios xamarin xamarin.ios