Geolocator.DesiredAccuracy | desiredAccuracy property

The accuracy level at which the Geolocator provides location updates.

Syntax


Public Property DesiredAccuracy As PositionAccuracy

Property value

Type: PositionAccuracy

The accuracy level at which the Geolocator provides location updates.

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.

Setting the DesiredAccuracy property of the Geolocator object 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 or DesiredAccuracy are set, your app will use an accuracy setting of 500 meters (which corresponds to the default DesiredAccuracy setting). 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 the accuracy value that was set last.

Examples

The following example shows how to set the desired accuracy in JavaScript.


var geolocator = new Windows.Devices.Geolocation.Geolocator();
geolocator.desiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.default;
geolocator.desiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.high;


The following example shows how to set the desired accuracy in C#.


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

Requirements (device family)

Device family

Universal

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.Devices.Geolocation
Windows::Devices::Geolocation [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (operating system)

Minimum supported client

Windows 8

Minimum supported server

None supported

Minimum supported phone

Windows Phone 8

Namespace

Windows.Devices.Geolocation
Windows::Devices::Geolocation [C++]

Metadata

Windows.winmd

See also

Geolocator

 

 

Show:
© 2015 Microsoft