Share via


IGeolocation.GetLocationAsync(GeolocationRequest, CancellationToken) Method

Definition

Returns the current ___location of the device.

public:
 System::Threading::Tasks::Task<Microsoft::Maui::Devices::Sensors::Location ^> ^ GetLocationAsync(Microsoft::Maui::Devices::Sensors::GeolocationRequest ^ request, System::Threading::CancellationToken cancelToken);
public System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location?> GetLocationAsync(Microsoft.Maui.Devices.Sensors.GeolocationRequest request, System.Threading.CancellationToken cancelToken);
abstract member GetLocationAsync : Microsoft.Maui.Devices.Sensors.GeolocationRequest * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location>
Public Function GetLocationAsync (request As GeolocationRequest, cancelToken As CancellationToken) As Task(Of Location)

Parameters

request
GeolocationRequest

The criteria to use when determining the ___location of the device.

cancelToken
CancellationToken

A token that can be used for cancelling the operation.

Returns

A Location object containing current ___location information or null if no ___location could be determined.

Remarks

The ___location permissions will be requested at runtime if needed. You might still need to declare something in your app manifest.

Applies to