public void OnConnected(Bundle connectionHint) { var location = LocationServices.FusedLocationApi.GetLastLocation(googleApiClient); if (location != null) LastLocation = new Location(location.Latitude, location.Longitude); LocationServices.FusedLocationApi.RequestLocationUpdates(googleApiClient, CreateLocationRequest(), this); Console.WriteLine("[SimpleLocation: Location updates started]"); }
void InitLocationManager() { if (locationManager == null) { locationManager = new CLLocationManager(); locationManager.LocationsUpdated += (sender, e) => { var location = e.Locations.Last(); LastLocation = new Location(location.Coordinate.Latitude, location.Coordinate.Longitude); LocationUpdated(); }; if (locationManager.Location != null) LastLocation = new Location(locationManager.Location.Coordinate.Latitude, locationManager.Location.Coordinate.Longitude); } }
public void OnLocationChanged(Android.Locations.Location location) { if (location == null) return; LastLocation = new Location(location.Latitude, location.Longitude); LocationUpdated(); }