Dela via


ConnectionProfile.GetNetworkUsageAsync Method

Definition

Gets a list of the estimated data traffic and connection duration over a specified period of time, for a specific network usage state.

DataUsageGranularity is used to indicate the desired granularity of the returned data and affects the length of the returned list. NetworkUsageStates is used to indicate the desired network usage configuration.

public:
 virtual IAsyncOperation<IVectorView<NetworkUsage ^> ^> ^ GetNetworkUsageAsync(DateTime startTime, DateTime endTime, DataUsageGranularity granularity, NetworkUsageStates states) = GetNetworkUsageAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<IVectorView<NetworkUsage>> GetNetworkUsageAsync(DateTime const& startTime, DateTime const& endTime, DataUsageGranularity const& granularity, NetworkUsageStates const& states);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<IReadOnlyList<NetworkUsage>> GetNetworkUsageAsync(System.DateTimeOffset startTime, System.DateTimeOffset endTime, DataUsageGranularity granularity, NetworkUsageStates states);
function getNetworkUsageAsync(startTime, endTime, granularity, states)
Public Function GetNetworkUsageAsync (startTime As DateTimeOffset, endTime As DateTimeOffset, granularity As DataUsageGranularity, states As NetworkUsageStates) As IAsyncOperation(Of IReadOnlyList(Of NetworkUsage))

Parameters

startTime
DateTime DateTimeOffset

The start time over which to retrieve data. Can be no more than 60 days prior to the current time. If the specified granularity is PerMinute, then the start time can be no more than 120 minutes prior to the current time.

endTime
DateTime DateTimeOffset

The end time over which to retrieve data. This time must be later than the startTime.

granularity
DataUsageGranularity

The desired granularity of the returned usage statistics. Each elements in the list corresponds to the network usage per the specified granularity; for example, usage per hour.

states
NetworkUsageStates

The state of the connection profile for which usage data should be returned.

Returns

When the method completes, it returns a list of NetworkUsage objects, which indicate the sent and received values, in bytes, and the total amount of time the profile was connected during the corresponding time interval. The entries are in chronological order, starting at the startTime. If the time span is not an exact multiple of the granularity, then the last entry will report usage only up to the endTime.

Attributes

Remarks

For an example of how these methods are used, see How to retrieve connection usage data for a specific period of time.

Applies to

See also