Search code examples
c#geolocationwindows-phone-8

Why is GeoCoordinateWatcher's DesiredAccuracy property readonly?


This code;

    GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();
    watcher.DesiredAccuracy = GeoPositionAccuracy.High;

...fails with: "Property or indexer 'System.Device.Location.GeoCoordinateWatcher.DesiredAccuracy' cannot be assigned to -- it is read only"

Why would DesiredAccuracy be readonly? If that's really so, it should be named Accuracy, or perhaps AttemptedAccuracy, but not DesiredAccuracy.


Solution

  • The GeoPositionAccuracy property is set via a constructor argument. Its name includes Desired because it was the accuracy that was desired when the watcher was constructed.

    They have several stern warnings about using an accuracy of High, which leads me to believe the property is read-only is because of the effort involved in switching the desired accuracy frequently may incur additional charges to the user.