How To Pause/Stop Updating Geolocation in UWP C#

I'm trying to stop tracking my location from a button. Does anyone know how to do this? I tried to unsubscribe from the positionChanged event but "It doesn't exist in the current context" (from inside my stop button event)

        private void StopTrakBtn_Click(object sender, RoutedEventArgs e)
    {
        geolocator1.PositionChanged -= Geolocator_PositionChanged;
    }

Maybe I'm going about this all wrong. Anyone able to help?

Answers


I`ve seen that, besides unsubscribing, if I set the ReportInterval to 0, it does not trigger updates:

locator.ReportInterval = default(uint)

Need Your Help

Can't set Access-Control-Allow-Origin request header

ajax xmlhttprequest

I making an AJAX request to the food2fork api and can't get by the No 'Access-Control-Allow-Origin' header is present error. I've tried setting the header in beforeSend and setting crossDomain: tru...