Search code examples
windows-8microsoft-metrocompass-geolocation

Start/Stop compass sensor


Is there any option to start/stop compass after compass sensor was requested.

I would to stop receiving events from compass to save battery but found no such an option (no dispose, no close, no stop as we have for windows phone)

Thanks!


Solution

  • if you are using C# you can unsubscribe for the event to stop receiving notifications from the compass. I dont think it is possible to turn off the compass altogether as other applications may be using it

    Subscribe:

           _compass.ReadingChanged += new TypedEventHandler<Compass, CompassReadingChangedEventArgs>(ReadingChanged);
    

    UnSubscribe:

           _compass.ReadingChanged -= ReadingChanged;