Sdílet prostřednictvím


Geolocation.StartListeningForegroundAsync(GeolocationListeningRequest) Metoda

Definice

Začne naslouchat aktualizacím polohy pomocí LocationChanged události nebo ListeningFailed události. Události se můžou posílat jenom v případě, že je aplikace v popředí. Požadavky Permissions.LocationWhenInUse od uživatele.

public:
 static System::Threading::Tasks::Task<bool> ^ StartListeningForegroundAsync(Microsoft::Maui::Devices::Sensors::GeolocationListeningRequest ^ request);
public static System.Threading.Tasks.Task<bool> StartListeningForegroundAsync (Microsoft.Maui.Devices.Sensors.GeolocationListeningRequest request);
static member StartListeningForegroundAsync : Microsoft.Maui.Devices.Sensors.GeolocationListeningRequest -> System.Threading.Tasks.Task<bool>
Public Shared Function StartListeningForegroundAsync (request As GeolocationListeningRequest) As Task(Of Boolean)

Parametry

request
GeolocationListeningRequest

Parametry požadavku naslouchání, které se mají použít.

Návraty

true když se spustilo naslouchání nebo false když nebylo možné spustit poslech.

Výjimky

Vyvolá se, když request je null.

Vyvolá se, pokud na této platformě není podporované naslouchání.

Vyvolá se, pokud už naslouchá a IsListeningForeground vrátí true.

Platí pro