Geolocator.GetGeopositionHistoryAsync 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
GetGeopositionHistoryAsync(DateTime) |
Starts an asynchronous operation to retrieve the location history of the device. Note This API is not available to all Windows apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. |
GetGeopositionHistoryAsync(DateTime, TimeSpan) |
Starts an asynchronous operation to retrieve the location history of the device. Note This API is not available to all Windows apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime. |
GetGeopositionHistoryAsync(DateTime)
Starts an asynchronous operation to retrieve the location history of the device.
Note
This API is not available to all Windows apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime.
public:
static IAsyncOperation<IVectorView<Geoposition ^> ^> ^ GetGeopositionHistoryAsync(DateTime startTime);
/// [Windows.Foundation.Metadata.Overload("GetGeopositionHistoryAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
static IAsyncOperation<IVectorView<Geoposition>> GetGeopositionHistoryAsync(DateTime const& startTime);
[Windows.Foundation.Metadata.Overload("GetGeopositionHistoryAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IReadOnlyList<Geoposition>> GetGeopositionHistoryAsync(System.DateTimeOffset startTime);
function getGeopositionHistoryAsync(startTime)
Public Shared Function GetGeopositionHistoryAsync (startTime As DateTimeOffset) As IAsyncOperation(Of IReadOnlyList(Of Geoposition))
Parameters
- startTime
- DateTime DateTimeOffset
Represents the beginning of the time span for which positions are to be returned.
Returns
Positions (of type Geoposition) that were collected during the specified time span.
- Attributes
Windows requirements
App capabilities |
locationHistory
location
|
Remarks
The GetGeopositionHistoryAsync method allows your app to asynchronously fetch a list of positions that have been collected by location services. Only positions that have been collected since the specified startTime will be returned. If no positions are available from that time span, an empty list will be returned.
This method returns only positions that have already been collected by location services in the last 24 hours; it does not resolve new positions. Specifying a time span that exceeds this 24-hour window will not yield any additional positions.
Location services collects positions only when an app or services queries for the user's location - but no more than once per second. Location history is limited to 3600 positions; if location history isn't cleared by the user, each position will be stored in location history between 1 and 24 hours.
Note
If you use a background task to call this method frequently, it's important to consider the impact that will have on the battery. Although this method doesn't trigger the GPS receiver, processor resources are still required to run the background task.
See also
- GetGeopositionHistoryAsync(DateTime, TimeSpan)
- Get current location
- Set up a geofence
- geolocation sample
Applies to
GetGeopositionHistoryAsync(DateTime, TimeSpan)
Starts an asynchronous operation to retrieve the location history of the device.
Note
This API is not available to all Windows apps. Unless your developer account is specially provisioned by Microsoft, calls to these APIs will fail at runtime.
public:
static IAsyncOperation<IVectorView<Geoposition ^> ^> ^ GetGeopositionHistoryAsync(DateTime startTime, TimeSpan duration);
/// [Windows.Foundation.Metadata.Overload("GetGeopositionHistoryWithDurationAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
static IAsyncOperation<IVectorView<Geoposition>> GetGeopositionHistoryAsync(DateTime const& startTime, TimeSpan const& duration);
[Windows.Foundation.Metadata.Overload("GetGeopositionHistoryWithDurationAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<IReadOnlyList<Geoposition>> GetGeopositionHistoryAsync(System.DateTimeOffset startTime, System.TimeSpan duration);
function getGeopositionHistoryAsync(startTime, duration)
Public Shared Function GetGeopositionHistoryAsync (startTime As DateTimeOffset, duration As TimeSpan) As IAsyncOperation(Of IReadOnlyList(Of Geoposition))
Parameters
- startTime
- DateTime DateTimeOffset
Represents the beginning of the time span for which positions are to be returned.
Represents the length of time after startTime for which positions are to be returned.
Returns
Positions (of type Geoposition) that were collected during the specified time span.
- Attributes
Windows requirements
App capabilities |
locationHistory
location
|
Remarks
Only positions that were collected during the specified duration after startTime will be returned.