protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { if (_locationManager != null) { throw new MvxException("You cannot start the MvxLocation service more than once"); } _locationManager = (LocationManager)Context.GetSystemService(Context.LocationService); if (_locationManager == null) { MvxTrace.Warning("Location Service Manager unavailable - returned null"); SendError(MvxLocationErrorCode.ServiceUnavailable); return; } var criteria = new Criteria { Accuracy = options.EnableHighAccuracy ? Accuracy.Fine : Accuracy.Coarse }; var bestProvider = _locationManager.GetBestProvider(criteria, true); if (bestProvider == null) { MvxTrace.Warning("Location Service Provider unavailable - returned null"); SendError(MvxLocationErrorCode.ServiceUnavailable); return; } // 4th September 2013 - defaults changed to 0,0 - meaning send updates as often as possible _locationManager.RequestLocationUpdates(bestProvider, 0, 0, _locationListener); // TODO - Ideally - _geoWatcher.MovementThreshold needed too }
protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { lock (this) { if (_locationManager != null) { throw new MvxException("You cannot start the MvxLocation service more than once"); } _locationManager = new CLLocationManager(); _locationManager.Delegate = new LocationDelegate(this); // more needed here for more filtering // _locationManager.DistanceFilter = options. CLLocationDistance.FilterNone _locationManager.DesiredAccuracy = options.EnableHighAccuracy ? CLLocation.AccuracyBest : CLLocation.AccuracyKilometer; if (CLLocationManager.HeadingAvailable) { _locationManager.StartUpdatingHeading(); } _locationManager.StartUpdatingLocation(); } }
public void Start(MvxGeoLocationOptions options, Action<MvxGeoLocation> success, Action<MvxLocationError> error) { lock (this) { _locationCallback = success; _errorCallback = error; PlatformSpecificStart(options); } }
protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { lock (this) { if (_locationManager != null) throw new MvxException("You cannot start the MvxLocation service more than once"); _locationManager = new CLLocationManager(); _locationManager.Delegate = new LocationDelegate(this); //_locationManager.DesiredAccuracy = options.EnableHighAccuracy ? Accuracy.Fine : Accuracy.Coarse; _locationManager.StartUpdatingLocation(); } }
protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { if (_geoWatcher != null) throw new MvxException("You cannot start the MvxLocation service more than once"); _geoWatcher = new GeoCoordinateWatcher(options.EnableHighAccuracy ? GeoPositionAccuracy.High : GeoPositionAccuracy.Default); // see https://github.com/slodge/MvvmCross/issues/90 re: _geoWatcher.MovementThreshold _geoWatcher.StatusChanged += OnStatusChanged; _geoWatcher.PositionChanged += OnPositionChanged; _geoWatcher.Start(); }
protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { if (_geolocator != null) throw new MvxException("You cannot start the MvxLocation service more than once"); // see https://github.com/slodge/MvvmCross/issues/90 _geolocator = new Geolocator { // DesiredAccuracy = TODO options.EnableHighAccuracy // MovementThreshold = TODO // ReportInterval = TODO }; _geolocator.StatusChanged += OnStatusChanged; _geolocator.PositionChanged += OnPositionChanged; }
protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { lock (this) { if (_locationManager != null) { throw new MvxException("You cannot start the MvxLocation service more than once"); } _locationManager = new CLLocationManager(); _locationManager.Delegate = new LocationDelegate(this); #warning TODO DesiredAccuracy! Plus movement threshold? //_locationManager.DesiredAccuracy = options.EnableHighAccuracy ? Accuracy.Fine : Accuracy.Coarse; _locationManager.StartUpdatingLocation(); } }
protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { if (_geoWatcher != null) { throw new MvxException("You cannot start the MvxLocation service more than once"); } _geoWatcher = new GeoCoordinateWatcher(options.EnableHighAccuracy ? GeoPositionAccuracy.High : GeoPositionAccuracy.Default); // see https://github.com/slodge/MvvmCross/issues/90 re: _geoWatcher.MovementThreshold _geoWatcher.StatusChanged += OnStatusChanged; _geoWatcher.PositionChanged += OnPositionChanged; _geoWatcher.Start(); }
protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { if (_geoWatcher != null) { throw new MvxException("You cannot start the MvxLocation service more than once"); } _geoWatcher = new GeoCoordinateWatcher(options.EnableHighAccuracy ? GeoPositionAccuracy.High : GeoPositionAccuracy.Default); #warning _geoWatcher.MovementThreshold needed too // _geoWatcher.MovementThreshold _geoWatcher.StatusChanged += OnStatusChanged; _geoWatcher.PositionChanged += OnPositionChanged; _geoWatcher.Start(); }
protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { if (_locationManager != null) { throw new MvxException("You cannot start the MvxLocation service more than once"); } _locationManager = (LocationManager)Context.GetSystemService(Context.LocationService); var criteria = new Criteria() { Accuracy = options.EnableHighAccuracy ? Accuracy.Fine : Accuracy.Coarse }; var bestProvider = _locationManager.GetBestProvider(criteria, true); _locationManager.RequestLocationUpdates(bestProvider, 5000, 2, this); #warning _geoWatcher.MovementThreshold needed too }
protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { if (_geolocator != null) { throw new MvxException("You cannot start the MvxLocation service more than once"); } // see https://github.com/slodge/MvvmCross/issues/90 _geolocator = new Geolocator { // DesiredAccuracy = TODO options.EnableHighAccuracy // MovementThreshold = TODO // ReportInterval = TODO }; _geolocator.StatusChanged += OnStatusChanged; _geolocator.PositionChanged += OnPositionChanged; }
protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { lock (this) { if (_locationManager != null) throw new MvxException("You cannot start the MvxLocation service more than once"); _locationManager = new CLLocationManager(); _locationManager.Delegate = new LocationDelegate(this); // more needed here for more filtering // _locationManager.DistanceFilter = options. CLLocationDistance.FilterNone _locationManager.DesiredAccuracy = options.EnableHighAccuracy ? CLLocation.AccuracyBest : CLLocation.AccuracyKilometer; if (CLLocationManager.HeadingAvailable) _locationManager.StartUpdatingHeading(); _locationManager.StartUpdatingLocation(); } }
protected override void PlatformSpecificStart(MvxGeoLocationOptions options) { if (_locationManager != null) throw new MvxException("You cannot start the MvxLocation service more than once"); _locationManager = (LocationManager) Context.GetSystemService(Context.LocationService); if (_locationManager == null) { MvxTrace.Warning( "Location Service Manager unavailable - returned null"); SendError(MvxLocationErrorCode.ServiceUnavailable); return; } var criteria = new Criteria {Accuracy = options.EnableHighAccuracy ? Accuracy.Fine : Accuracy.Coarse}; var bestProvider = _locationManager.GetBestProvider(criteria, true); if (bestProvider == null) { MvxTrace.Warning( "Location Service Provider unavailable - returned null"); SendError(MvxLocationErrorCode.ServiceUnavailable); return; } _locationManager.RequestLocationUpdates(bestProvider, 5000, 2, _locationListener); // TODO - Ideally - _geoWatcher.MovementThreshold needed too }
protected abstract void PlatformSpecificStart(MvxGeoLocationOptions options);