public void Init()
		{
			if (!locationWatcher.Started)
			{
				locationWatcher.Start(
					new MvxLocationOptions{Accuracy = MvxLocationAccuracy.Coarse},
					loc =>
					{
						UserLocation = loc;
						const double tolerance = 0.001;
						if (Math.Abs(loc.Coordinates.Latitude) > tolerance && 
							Math.Abs(loc.Coordinates.Longitude) > tolerance)
							locationWatcher.Stop();
					}, 
					error => { });
			}

			// defaults
			userAge = 0;
			userId = string.Empty;
			userGender = Gender.Unknown;
			userLocation = new MvxGeoLocation
			{
				Coordinates = new MvxCoordinates
				{
					Latitude = 0,
					Longitude = 0,
					Accuracy = 0
				}
			};
		}
 private void OnSuccess(MvxGeoLocation obj)
 {
     _parent.RunOnUiThread(() => {
                                     Lat = obj.Coordinates.Latitude;
                                     Lng = obj.Coordinates.Longitude;
                     });
 }
Ejemplo n.º 3
0
 protected virtual void SendLocation(MvxGeoLocation location)
 {
     LastSeenLocation = location;
     var callback = _locationCallback;
     if (callback != null)
         callback(location);
 }
        private void OnSuccess(MvxGeoLocation location)
        {
            var message = new LocationMessage(this, 
                                location.Coordinates.Latitude, 
                                location.Coordinates.Longitude);

            _messenger.Publish(message);
        }
 private void OnNewLocation(MvxGeoLocation location)
 {
     if (location != null && location.Coordinates != null)
     {
         Lat = location.Coordinates.Latitude;
         Lng = location.Coordinates.Longitude;
     }
 }
        protected virtual void SendLocation(MvxGeoLocation location)
        {
            var callback = _locationCallback;

            if (callback != null)
            {
                callback(location);
            }
        }
        private void OnLocationFound(MvxGeoLocation location)
        {
            try
            {
                Lat = location.Coordinates.Latitude.ToString();
                Lon = location.Coordinates.Longitude.ToString();
            }
            catch (Exception ex)
            {

            }
        }
        private void OnSuccess(MvxGeoLocation location)
        {
            lock (_lockObject)
            {
                _latestLocation = location;
            }

            var message = new LocationMessage(this, 
                                location.Coordinates.Latitude, 
                                location.Coordinates.Longitude);

            _messenger.Publish(message);
        }
 private void OnLocation(MvxGeoLocation location)
 {
     Location = location;
 }
Ejemplo n.º 10
0
 private void OnLocation(MvxGeoLocation obj)
 {
 }
Ejemplo n.º 11
0
		void OnLocation(MvxGeoLocation location)
		{
			this.LastKnownLocation = location;
		}
Ejemplo n.º 12
0
		public LocationUpdatedMessege(object sender, MvxGeoLocation location = null)
			: base(sender)
		{
			Location = location;
		}
Ejemplo n.º 13
0
        private void UpdateLocation(MvxGeoLocation location)
        {
            var lat = "Unknown";
            var lng = "Unknown";

            if (location != null
                && location.Coordinates != null)
            {
                lat = location.Coordinates.Latitude.ToString();
                lng = location.Coordinates.Longitude.ToString();
            }

            _latText.Text = lat;
            _lngText.Text = lng;
        }
Ejemplo n.º 14
0
 private void OnLocation(MvxGeoLocation location)
 {
     RunOnUiThread(() => UpdateLocation(location));
 }
Ejemplo n.º 15
0
 private void OnLocation(MvxGeoLocation location)
 {
     Lat = location.Coordinates.Latitude;
     Lng = location.Coordinates.Longitude;
     HasGpsLocation = true;
 }
Ejemplo n.º 16
0
 private void OnLocation(MvxGeoLocation location)
 {
     StatusMessage = "Current location is:";
     Latitude = location.Coordinates.Latitude.ToString();
     Longitude = location.Coordinates.Longitude.ToString();
 }
        public MvxGeoLocation ComputeCurrentPosition()
        {
            _lastUpdate = DateTime.UtcNow;
            _currentLocationIndex = _currentLocationIndex + 1;

            var location = _sensorData.Locations[_currentLocationIndex];
            _currentLocation = ConvertToMvxGeoLocation(location);
            return _currentLocation;
        }
        private static MvxGeoLocation CreateLocation(Location androidLocation)
        {
            var position = new MvxGeoLocation {Timestamp = androidLocation.Time.FromMillisecondsUnixTimeToUtc()};
            var coords = position.Coordinates;

            if (androidLocation.HasAltitude)
                coords.Altitude = androidLocation.Altitude;

            if (androidLocation.HasBearing)
                coords.Heading = androidLocation.Bearing;

            coords.Latitude = androidLocation.Latitude;
            coords.Longitude = androidLocation.Longitude;
            if (androidLocation.HasSpeed)
                coords.Speed = androidLocation.Speed;
            if (androidLocation.HasAccuracy)
            {
                coords.Accuracy = androidLocation.Accuracy;
            }

            return position;
        }