Share via


Geolocator.DesiredAccuracy Property

Definition

The accuracy level at which the Geolocator provides location updates.

public:
 property PositionAccuracy DesiredAccuracy { PositionAccuracy get(); void set(PositionAccuracy value); };
PositionAccuracy DesiredAccuracy();

void DesiredAccuracy(PositionAccuracy value);
public PositionAccuracy DesiredAccuracy { get; set; }
var positionAccuracy = geolocator.desiredAccuracy;
geolocator.desiredAccuracy = positionAccuracy;
Public Property DesiredAccuracy As PositionAccuracy

Property Value

The accuracy level at which the Geolocator provides location updates.

Windows requirements

App capabilities
location ID_CAP_LOCATION [Windows Phone]

Examples

The following example shows how to set the desired accuracy.

Geolocator geolocator = new Geolocator();
geolocator.DesiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.Default;
geolocator.DesiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.High;

Remarks

Set DesiredAccuracy to High only if your application requires the most accurate data available. Set DesiredAccuracy to Default to optimize for power.

Note

Some hardware may not support high accuracy location data. If your app attempts to set accuracy to a value that's not supported, accuracy will be set to the limit that the hardware supports. Therefore, setting the DesiredAccuracy property is not guaranteed to have an effect on the accuracy of data.

The DesiredAccuracyInMeters property provides more granularity and control of the accuracy of the position results. Most applications can simply use the DesiredAccuracy property.

When neither DesiredAccuracyInMeters nor DesiredAccuracy are set, your app will use an accuracy setting of 500 meters (which corresponds to the DesiredAccuracy setting of Default). Setting DesiredAccuracy to Default or High indirectly sets DesiredAccuracyInMeters to 500 or 10 meters, respectively. When your app sets both DesiredAccuracy and DesiredAccuracyInMeters, your app will use whichever accuracy value was set last.

Applies to