Skip to content

Commit

Permalink
Only Process Most Recent Location
Browse files Browse the repository at this point in the history
  • Loading branch information
TheWatchfulOne committed May 23, 2021
1 parent 8f5987a commit 020b466
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Geolocator.Plugin/Apple/GeolocatorImplementation.apple.cs
Original file line number Diff line number Diff line change
Expand Up @@ -492,8 +492,10 @@ CLLocationManager GetManager()

void OnLocationsUpdated(object sender, CLLocationsUpdatedEventArgs e)
{
foreach (var location in e.Locations)
UpdatePosition(location);
if (e.Locations.Any())
{
UpdatePosition(e.Locations.Last());
}

// defer future location updates if requested
if ((listenerSettings?.DeferLocationUpdates ?? false) && !deferringUpdates && CanDeferLocationUpdate)
Expand Down

0 comments on commit 020b466

Please sign in to comment.