Geolocator.GetGeopositionAsync(TimeSpan, TimeSpan) | getGeopositionAsync(TimeSpan, TimeSpan) method

Applies to Windows and Windows Phone

Starts an asynchronous operation to retrieve the current location of the device.

Syntax


Public Function GetGeopositionAsync(
  maximumAge As TimeSpan,  
  timeout As TimeSpan 
) As IAsyncOperation(Of Geoposition)

Parameters

maximumAge

Type: Number [JavaScript] | System.TimeSpan [.NET] | Windows::Foundation::TimeSpan [C++]

The maximum acceptable age of cached location data. A TimeSpan is a time period expressed in 100-nanosecond units.

timeout

Type: Number [JavaScript] | System.TimeSpan [.NET] | Windows::Foundation::TimeSpan [C++]

The timeout. A TimeSpan is a time period expressed in 100-nanosecond units.

Return value

Type: IAsyncOperation<Geoposition>

Provides methods for starting the asynchronous request for location data and handling its completion.

Remarks

  • Applies to Windows

The first use of the Geolocator object to call GetGeopositionAsync must be made on the UI thread so that the consent prompt can be shown to the user. For more information, see Guidelines for devices that access personal data.

  • Applies to Windows

When in Connected Standby, Geolocator objects can always be instantiated but the Geolocator object will not find any sensors to aggregate and calls to GetGeopositionAsync will time out after 7 seconds, PositionChanged event listeners will never be called, and StatusChanged event listeners will be called once with the NoData status.

Requirements

Minimum supported client

Windows 8

Minimum supported server

None supported

Minimum supported phone

Windows Phone 8

Namespace

Windows.Devices.Geolocation
Windows::Devices::Geolocation [C++]

Metadata

Windows.winmd

Capabilities

ID_CAP_LOCATION [Windows Phone]

See also

Geoposition
Geocoordinate
Geolocator
GetGeopositionAsync

 

 

Show:
© 2014 Microsoft