Esempio n. 1
0
        public async void StartLocationUpdates()
        {
            // We need the user's permission for our app to use the GPS in iOS. This is done either by the user accepting
            // the popover when the app is first launched, or by changing the permissions for the app in Settings
            if (CLLocationManager.LocationServicesEnabled)
            {
                //set the desired accuracy, in meters
                LocationManager.DesiredAccuracy = CLLocation.AccuracyBest;
                LocationManager.DistanceFilter  = AppConfiguration.MINIMUM_DISTANCE_M;

                LocationsAggregator = await LocationsAggregator.GetInstance();

                LocationManager.LocationsUpdated += (object sender, CLLocationsUpdatedEventArgs e) => {
                    foreach (CLLocation location in e.Locations)
                    {
                        LocationsAggregator.RecordLocation(location.Coordinate.Longitude, location.Coordinate.Latitude,
                                                           location.Course, location.Speed, location.HorizontalAccuracy);
                    }
                };

                LocationManager.StartUpdatingLocation();
            }
        }
Esempio n. 2
0
 public void OnLocationChanged(Location location)
 {
     LocationsAggregator.RecordLocation(location.Longitude, location.Latitude,
                                        location.Bearing, location.Speed, location.Accuracy);
 }