Aracılığıyla paylaş


IGeolocation.StartListeningForegroundAsync Method

Definition

Starts listening to location updates using the LocationChanged event. Events may only sent when the app is in the foreground. Requests Permissions.LocationWhenInUse from the user.

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)

Parameters

request
GeolocationListeningRequest

The listening request parameters to use.

Returns

true when listening was started, or false when listening couldn't be started.

Exceptions

Thrown when request is null.

Thrown if listening is not supported on this platform.

Thrown if already listening and IsListeningForeground returns true.

Applies to