Compartilhar via


Geolocation.StartListeningForegroundAsync(GeolocationListeningRequest) Método

Definição

Inicia a escuta de atualizações de localização usando o LocationChanged evento ou o ListeningFailed evento . Os eventos só podem ser enviados quando o aplicativo está em primeiro plano. Solicitações Permissions.LocationWhenInUse do usuário.

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)

Parâmetros

request
GeolocationListeningRequest

Os parâmetros de solicitação de escuta a serem usados.

Retornos

true quando a escuta foi iniciada ou false quando a escuta não pôde ser iniciada.

Exceções

Lançada quando request é null.

Gerado se não houver suporte para escuta nesta plataforma.

Gerado se já estiver escutando e IsListeningForeground retornar true.

Aplica-se a