Freigeben über


IGeolocation.GetLocationAsync(GeolocationRequest, CancellationToken) Methode

Definition

Gibt den aktuellen Standort des Geräts zurück.

public:
 System::Threading::Tasks::Task<Microsoft::Maui::Devices::Sensors::Location ^> ^ GetLocationAsync(Microsoft::Maui::Devices::Sensors::GeolocationRequest ^ request, System::Threading::CancellationToken cancelToken);
public System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location?> GetLocationAsync (Microsoft.Maui.Devices.Sensors.GeolocationRequest request, System.Threading.CancellationToken cancelToken);
abstract member GetLocationAsync : Microsoft.Maui.Devices.Sensors.GeolocationRequest * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location>
Public Function GetLocationAsync (request As GeolocationRequest, cancelToken As CancellationToken) As Task(Of Location)

Parameter

request
GeolocationRequest

Die Kriterien, die bei der Bestimmung des Standorts des Geräts verwendet werden sollen.

cancelToken
CancellationToken

Ein Token, das zum Abbrechen des Vorgangs verwendet werden kann.

Gibt zurück

Ein Location Objekt, das aktuelle Standortinformationen enthält, oder null , wenn kein Speicherort ermittelt werden konnte.

Hinweise

Die Standortberechtigungen werden bei Bedarf zur Laufzeit angefordert. Möglicherweise müssen Sie noch etwas in Ihrem App-Manifest deklarieren.

Gilt für: