private async void Geolocator_PositionChanged(object sender, PositionEventArgs e) { if (!_isRunning) { return; } _preferences ??= Mvx.IoCProvider.Resolve <IPreferences>(); if (_preferences.Get(UserSettingsKeys.LiveLocationSharingEnabled, false) == false) { GeolocationHelper.StopLocationService(); return; } try { _preferences.Set(UserSettingsKeys.LiveLocationSharingEnabled, true); var position = new Position(e.Position.Latitude, e.Position.Longitude); await UpdateLocation(position); } catch (Exception ex) { _loggingService ??= Mvx.IoCProvider.Resolve <ILoggingService>(); _loggingService.Error(ex, "Error Executing LiveGeolocationService.Geolocator_PositionChanged"); } }
static GeolocationHelper() { Current = new GeolocationHelper(); }