예제 #1
0
        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);
	            
	#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);
#warning _geoWatcher.MovementThreshold needed too
            // _geoWatcher.MovementThreshold
            _geoWatcher.StatusChanged += OnStatusChanged;
            _geoWatcher.PositionChanged += OnPositionChanged;
            _geoWatcher.Start();
        }
예제 #4
0
 protected abstract void PlatformSpecificStart(MvxGeoLocationOptions options);