ConnectionProfile.GetNetworkUsageAsync | getNetworkUsageAsync method

Applies to Windows and Windows Phone

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.

Syntax


public IAsyncOperation<IReadOnlyList> GetNetworkUsageAsync(
  DateTimeOffset startTime, 
  DateTimeOffset endTime, 
  DataUsageGranularity granularity, 
  NetworkUsageStates states
)

Parameters

startTime

Type: Date [JavaScript] | System.DateTimeOffset [.NET] | Windows::Foundation::DateTime [C++]

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, the start time can be no more than 120 minutes prior to the current time.

endTime

Type: Date [JavaScript] | System.DateTimeOffset [.NET] | Windows::Foundation::DateTime [C++]

The end time over which to retrieve data.

granularity

Type: DataUsageGranularity

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

states

Type: NetworkUsageStates

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

Return value

Type: IAsyncOperation<IVectorView>

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.

Remarks

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

Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Networking.Connectivity
Windows::Networking::Connectivity [C++]

Metadata

Windows.winmd

See also

ConnectionProfile
DataUsageGranularity
NetworkUsage
NetworkUsageStates

 

 

Show:
© 2014 Microsoft