Exemple #1
0
        public async Task StartListeningLocation()
        {
            await AppGeolocator.StartListeningAsync(MyGeoFlag, 1000);//minDistance will take priority

            AppGeolocator.Current.PositionChanged += PositionChanged;
            AppGeolocator.Current.PositionError   += PositionError;


            try
            {   //Starting Position
                var positionStart = await Task.Run(() => AppGeolocator.Current.GetPositionAsync(TimeSpan.FromMilliseconds(50), null, false).Result);

                PositionChanged(this, new PositionEventArgs(positionStart));
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Unable to get location: " + ex);
            }
        }
Exemple #2
0
        public async Task StopListeningLocation(bool stopGeolocator, bool ifDataReset)
        {
            LocFlag = LocationFlag.Stop;

            LastPFlag = new Plugin.Geolocator.Abstractions.Position();

            if (ifDataReset == true)
            {
                platformRoad = new object();//is delete

                RouteCoordinates.Clear();
                LastCoordinates.Clear();
                DrawPoint = null;
                LastPFlag = null;
            }

            AppGeolocator.Current.PositionChanged -= PositionChanged;
            AppGeolocator.Current.PositionError   -= PositionError;

            await AppGeolocator.StopListeningAsync(MyGeoFlag, stopGeolocator);
        }
Exemple #3
0
        public async Task StopListeningLocation(bool stopGeolocator, bool ifDataReset)
        {
            AppGeolocator.Current.PositionChanged -= PositionChanged;
            AppGeolocator.Current.PositionError   -= PositionError;

            await AppGeolocator.StopListeningAsync(MyGeoFlag, stopGeolocator);


            if (ifDataReset == true)
            {
                RouteCoordinates.Clear();
                WorkoutData.Reset();
                NewWorkoutPoint = null;

                NumberOfPoint = 0;
                lastInterval  = new DateTime(0);
                startWorkout  = new DateTime(0);

                ResetCounter();
            }
        }
Exemple #4
0
        public async Task StartListeningLocation()
        {
            if (CheckGeoPermissions(true) == false)
            {
                AskForPermissions();
                return;
            }

            await AppGeolocator.StartListeningAsync(MyGeoFlag, 1000);//minDistance will take priority

            LocFlag = LocationFlag.Start;
            AppGeolocator.Current.PositionChanged += PositionChanged;
            AppGeolocator.Current.PositionError   += PositionError;

            try
            {   //Starting Position
                var positionStart = await Task.Run(() => AppGeolocator.Current.GetPositionAsync(TimeSpan.FromMilliseconds(50), null, false).Result);

                PositionChanged(this, new Plugin.Geolocator.Abstractions.PositionEventArgs(positionStart));
            }
            catch (Exception ex) {
                Debug.WriteLine("Unable to get location: " + ex);
            }
        }