GeoLocator PositionChanged event is triggered too often
-
20-12-2019 - |
Frage
I'm using the GeoLocator class for a location aware app, I would like the position to be updated once every minute to save battery. I have set the ReportInverval attribute accordingly but the PositionChanged event is getting triggered much more frequently. What is wrong here?
App.Geolocator = new Geolocator();
App.Geolocator.DesiredAccuracy = PositionAccuracy.High;
App.Geolocator.MovementThreshold = 100;
App.Geolocator.ReportInterval = 1000*60; //report change every minute
App.Geolocator.PositionChanged += geolocator_PositionChanged;
Lösung
That should give you a location every minute but the documentation does say:
If another application has requested more frequent updates, by specifying a smaller value for ReportInterval, your application may receive updates at a higher frequency than requested
Andere Tipps
Found out why it is not working. The solution was to not use MovementTreshold because it takes precedence over ReportInterval.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow