Compartilhar via


IGeolocation.StartListeningForegroundAsync Método

Definição

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

public:
 System::Threading::Tasks::Task<bool> ^ StartListeningForegroundAsync(Microsoft::Maui::Devices::Sensors::GeolocationListeningRequest ^ request);
public System.Threading.Tasks.Task<bool> StartListeningForegroundAsync (Microsoft.Maui.Devices.Sensors.GeolocationListeningRequest request);
abstract member StartListeningForegroundAsync : Microsoft.Maui.Devices.Sensors.GeolocationListeningRequest -> System.Threading.Tasks.Task<bool>
Public 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