Geolocation.StartListeningForegroundAsync(GeolocationListeningRequest) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Starts listening to location updates using the LocationChanged event or the ListeningFailed event. Events may only sent when the app is in the foreground. Requests Permissions.LocationWhenInUse from the user.
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)
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
.