Share via


IGeolocation.GetLastKnownLocationAsync Method

Definition

Returns the last known location of the device.

public:
 System::Threading::Tasks::Task<Microsoft::Maui::Devices::Sensors::Location ^> ^ GetLastKnownLocationAsync();
public System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location?> GetLastKnownLocationAsync ();
abstract member GetLastKnownLocationAsync : unit -> System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location>
Public Function GetLastKnownLocationAsync () As Task(Of Location)

Returns

A Location object containing recent location information or null if no location is known.

Remarks

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

This location may be a recently cached location.

Applies to