Geolocation.GetLocationAsync Method

Definition

Overloads

GetLocationAsync()

Returns the current location of the device.

GetLocationAsync(GeolocationRequest)

Returns the current location of the device using the specified criteria.

GetLocationAsync(GeolocationRequest, CancellationToken)

Returns the current location of the device using the specified criteria.

GetLocationAsync()

Returns the current location of the device.

C#
public static System.Threading.Tasks.Task<Xamarin.Essentials.Location> GetLocationAsync ();

Returns

System.Threading.Tasks.Task<Location>

Returns the location.

Applies to

Xamarin Essentials Android Latest and other versions
Product Versions
Xamarin Essentials Android Latest
Xamarin Essentials iOS Latest
Xamarin Essentials Shared Latest
Xamarin Essentials TVOS Latest
Xamarin Essentials UWP Latest
Xamarin Essentials WatchOS Latest

GetLocationAsync(GeolocationRequest)

Returns the current location of the device using the specified criteria.

C#
public static System.Threading.Tasks.Task<Xamarin.Essentials.Location> GetLocationAsync (Xamarin.Essentials.GeolocationRequest request);

Parameters

request
GeolocationRequest

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

Returns

System.Threading.Tasks.Task<Location>

Returns the location.

Applies to

Xamarin Essentials Android Latest and other versions
Product Versions
Xamarin Essentials Android Latest
Xamarin Essentials iOS Latest
Xamarin Essentials Shared Latest
Xamarin Essentials TVOS Latest
Xamarin Essentials UWP Latest
Xamarin Essentials WatchOS Latest

GetLocationAsync(GeolocationRequest, CancellationToken)

Returns the current location of the device using the specified criteria.

C#
public static System.Threading.Tasks.Task<Xamarin.Essentials.Location> GetLocationAsync (Xamarin.Essentials.GeolocationRequest request, System.Threading.CancellationToken cancelToken);

Parameters

request
GeolocationRequest

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

cancelToken
System.Threading.CancellationToken

A token for cancelling the operation.

Returns

System.Threading.Tasks.Task<Location>

Returns the location.

Applies to

Xamarin Essentials Android Latest and other versions
Product Versions
Xamarin Essentials Android Latest
Xamarin Essentials iOS Latest
Xamarin Essentials Shared Latest
Xamarin Essentials TVOS Latest
Xamarin Essentials UWP Latest
Xamarin Essentials WatchOS Latest