GeolocationExtensions.GetLocationAsync 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.
Overloads
GetLocationAsync(IGeolocation) |
Returns the current location of the device. |
GetLocationAsync(IGeolocation, GeolocationRequest) |
Returns the current location of the device. |
GetLocationAsync(IGeolocation)
- Source:
- Geolocation.shared.cs
- Source:
- Geolocation.shared.cs
Returns the current location of the device.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<Microsoft::Maui::Devices::Sensors::Location ^> ^ GetLocationAsync(Microsoft::Maui::Devices::Sensors::IGeolocation ^ geolocation);
public static System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location?> GetLocationAsync (this Microsoft.Maui.Devices.Sensors.IGeolocation geolocation);
static member GetLocationAsync : Microsoft.Maui.Devices.Sensors.IGeolocation -> System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location>
<Extension()>
Public Function GetLocationAsync (geolocation As IGeolocation) As Task(Of Location)
Parameters
- geolocation
- IGeolocation
The object this method is invoked on.
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
GetLocationAsync(IGeolocation, GeolocationRequest)
- Source:
- Geolocation.shared.cs
- Source:
- Geolocation.shared.cs
Returns the current location of the device.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<Microsoft::Maui::Devices::Sensors::Location ^> ^ GetLocationAsync(Microsoft::Maui::Devices::Sensors::IGeolocation ^ geolocation, Microsoft::Maui::Devices::Sensors::GeolocationRequest ^ request);
public static System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location?> GetLocationAsync (this Microsoft.Maui.Devices.Sensors.IGeolocation geolocation, Microsoft.Maui.Devices.Sensors.GeolocationRequest request);
static member GetLocationAsync : Microsoft.Maui.Devices.Sensors.IGeolocation * Microsoft.Maui.Devices.Sensors.GeolocationRequest -> System.Threading.Tasks.Task<Microsoft.Maui.Devices.Sensors.Location>
<Extension()>
Public Function GetLocationAsync (geolocation As IGeolocation, request As GeolocationRequest) As Task(Of Location)
Parameters
- geolocation
- IGeolocation
The object this method is invoked on.
- request
- GeolocationRequest
The criteria to use when determining the location of the device.
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.