Geolocator Class

可用來存取目前的地理位置。

語法


public ref class Geolocator sealed 

屬性

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

成員

Geolocator類別 具有下列類型的成員:

建構函式

Geolocator類別 具有這些建構函式。

建構函式描述
Geolocator Initializes a new Geolocator object.

 

事件

Geolocator類別 具有這些事件。

事件描述
PositionChanged Raised when the location is updated.
StatusChanged Raised when the ability of the Geolocator to provide updated location changes.

 

方法

The Geolocator 類別 擁有這些方法。 使用 C#、Visual Basic 和 C++,它也會繼承方法自Object 類別.

方法描述
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.

 

屬性

Geolocator類別 擁有這些屬性。

屬性存取類型描述

DesiredAccuracy

讀取/寫入The accuracy level at which the Geolocator provides location updates.

DesiredAccuracyInMeters

讀取/寫入Gets or sets the desired accuracy in meters for data returned from the location service.

LocationStatus

唯讀The status that indicates the ability of the Geolocator to provide location updates.

MovementThreshold

讀取/寫入Gets 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

讀取/寫入The 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.

 

備註

第一次使用 Geolocator 物件呼叫 GetGeopositionAsync 或訂閱 PositionChanged 事件必須是在 UI 執行緒上進行,以便向使用者顯示同意提示。如需詳細資訊,請參閱存取個人資料之裝置的方針

範例

這個範例說明如何呼叫 GetGeopositionAsync

No code example is currently available or this language may not be supported.

需求

支援的最小用戶端

Windows 8 [僅限 Windows 市集應用程式]

支援的最小伺服器

不支援 [僅限 Windows 市集應用程式]

支援的最小電話

Windows Phone 8

命名空間

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

Metadata

Windows.winmd

Capabilities

location
ID_CAP_LOCATION [Windows Phone]

 

 

顯示:
© 2014 Microsoft