EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

Geolocator class

Applies to Windows and Windows Phone

Provides access to the current geographic location.

Syntax


Public NotInheritable Class Geolocator

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]

Members

The Geolocator class has these types of members:

Constructors

The Geolocator class has these constructors.

ConstructorDescription
Geolocator Initializes a new Geolocator object.

 

Events

The Geolocator class has these events.

EventDescription
PositionChanged Raised when the location is updated.
StatusChanged Raised when the ability of the Geolocator to provide updated location changes.

 

Methods

The Geolocator class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
GetGeopositionAsync Starts an asynchronous operation to retrieve the current location of the device.
GetGeopositionAsync(TimeSpan,TimeSpan) Starts an asynchronous operation to retrieve the current location of the device.

 

Properties

The Geolocator class has these properties.

PropertyAccess typeDescription

DesiredAccuracy

Read/writeThe accuracy level at which the Geolocator provides location updates.

DesiredAccuracyInMeters

Read/writeGets or sets the desired accuracy in meters for data returned from the location service.

LocationStatus

Read-onlyThe status that indicates the ability of the Geolocator to provide location updates.

MovementThreshold

Read/writeGets and sets the distance of movement, in meters, relative to the coordinate from the last PositionChanged event, that is required for the Geolocator to raise a PositionChanged event.

ReportInterval

Read/writeThe requested minimum time interval between location updates, in milliseconds. If your application requires updates infrequently, set this value so that the location provider can conserve power by calculating location only when needed.

 

Remarks

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

  • Applies to Windows

Windows only:  The first use of the Geolocator object to call GetGeopositionAsync or subscribe to PositionChanged events must be made on the UI thread so that the consent prompt can be shown to the user. For more information, see Guidelines for devices that access personal data.

Examples

This example shows how to call GetGeopositionAsync.

Nenhum exemplo de código está disponível no momento ou este idioma talvez não seja suportado.

Requirements

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

None supported [Windows Store apps only]

Minimum supported phone

Windows Phone 8

Namespace

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

Metadata

Windows.winmd

Capabilities

location
ID_CAP_LOCATION [Windows Phone]

 

 

Mostrar:
© 2014 Microsoft