IGeolocation 介面

定義

提供取得裝置目前位置的方法。

public interface class IGeolocation
public interface IGeolocation
type IGeolocation = interface
Public Interface IGeolocation

屬性

IsListeningForeground

指出應用程式在前景時,目前是否正在接聽位置更新。

方法

GetLastKnownLocationAsync()

傳回裝置的最後一個已知位置。

GetLocationAsync(GeolocationRequest, CancellationToken)

傳回裝置的目前位置。

StartListeningForegroundAsync(GeolocationListeningRequest)

使用 LocationChanged 事件開始接聽位置更新。 只有在應用程式位於前景時,才會傳送事件。 來自使用者的要求 Permissions.LocationWhenInUse

StopListeningForeground()

當應用程式位於前景時,停止接聽位置更新。 目前false為時IsListeningForeground沒有任何作用。

事件

ListeningFailed

在接聽位置更新期間發生錯誤時發生。 引發事件時,接聽已停止進一步的位置更新,而且不會傳送任何進一步 LocationChanged 的事件。

LocationChanged

在接聽位置更新時發生。

擴充方法

GetLocationAsync(IGeolocation)

傳回裝置的目前位置。

GetLocationAsync(IGeolocation, GeolocationRequest)

傳回裝置的目前位置。

適用於