Sdílet prostřednictvím


GeolocationExtensions.GetLocationAsync Metoda

Definice

Přetížení

GetLocationAsync(IGeolocation)

Vrátí aktuální polohu zařízení.

GetLocationAsync(IGeolocation, GeolocationRequest)

Vrátí aktuální polohu zařízení.

GetLocationAsync(IGeolocation)

Zdroj:
Geolocation.shared.cs
Zdroj:
Geolocation.shared.cs

Vrátí aktuální polohu zařízení.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<Microsoft::Maui::Devices::Sensors::Location ^> ^ GetLocationAsync(Microsoft::Maui::Devices::Sensors::IGeolocation ^ geolocation);
public static System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location?> GetLocationAsync (this Microsoft.Maui.Devices.Sensors.IGeolocation geolocation);
static member GetLocationAsync : Microsoft.Maui.Devices.Sensors.IGeolocation -> System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location>
<Extension()>
Public Function GetLocationAsync (geolocation As IGeolocation) As Task(Of Location)

Parametry

geolocation
IGeolocation

Objekt, na který je tato metoda vyvolána.

Návraty

Objekt Location obsahující informace o aktuálním umístění nebo null pokud nelze určit žádné umístění.

Poznámky

V případě potřeby se oprávnění k umístění budou vyžadovat za běhu. Možná budete muset něco deklarovat v manifestu aplikace.

Platí pro

GetLocationAsync(IGeolocation, GeolocationRequest)

Zdroj:
Geolocation.shared.cs
Zdroj:
Geolocation.shared.cs

Vrátí aktuální polohu zařízení.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Threading::Tasks::Task<Microsoft::Maui::Devices::Sensors::Location ^> ^ GetLocationAsync(Microsoft::Maui::Devices::Sensors::IGeolocation ^ geolocation, Microsoft::Maui::Devices::Sensors::GeolocationRequest ^ request);
public static System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location?> GetLocationAsync (this Microsoft.Maui.Devices.Sensors.IGeolocation geolocation, Microsoft.Maui.Devices.Sensors.GeolocationRequest request);
static member GetLocationAsync : Microsoft.Maui.Devices.Sensors.IGeolocation * Microsoft.Maui.Devices.Sensors.GeolocationRequest -> System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location>
<Extension()>
Public Function GetLocationAsync (geolocation As IGeolocation, request As GeolocationRequest) As Task(Of Location)

Parametry

geolocation
IGeolocation

Objekt, na který je tato metoda vyvolána.

request
GeolocationRequest

Kritéria, která se mají použít při určování polohy zařízení.

Návraty

Objekt Location obsahující informace o aktuálním umístění nebo null pokud nelze určit žádné umístění.

Poznámky

V případě potřeby se oprávnění k umístění budou vyžadovat za běhu. Možná budete muset něco deklarovat v manifestu aplikace.

Platí pro