Share via


AttributedNetworkUsage Class

Definition

Represents per-attribution usage statistics (bytes sent, bytes received, connected duration) returned by ConnectionProfile.GetAttributedNetworkUsageAsync.

public ref class AttributedNetworkUsage sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
class AttributedNetworkUsage final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
public sealed class AttributedNetworkUsage
Public NotInheritable Class AttributedNetworkUsage
Inheritance
Object Platform::Object IInspectable AttributedNetworkUsage
Attributes

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Remarks

Retrieval

Instances are produced by calling ConnectionProfile.GetAttributedNetworkUsageAsync on a ConnectionProfile for a specified time window.

Attribution identity

  • AttributionId can represent an app, a system/service bucket, or an aggregated classification.
  • Absence of an expected id in a window means no recorded usage (not necessarily uninstalled).

Data characteristics

  • Values are aggregated for the requested window; not real-time counters (provider accounting latency applies).
  • Some buckets may report only sent or only received bytes; zeros are valid.
  • A trailing partial interval (window ends mid-granularity) is provisional; values may grow on later queries.

Residual / unattributed usage

The difference between aggregate usage (from GetNetworkUsageAsync) and the sum of attributed entries can represent system, privacy-suppressed, or otherwise unattributed traffic. Treat this as a logical "unattributed" bucket if full reconciliation is required.

Identifier stability

Do not treat AttributionId as a permanent device-unique key. Rebase mappings after OS upgrade, device reset, or policy changes.

Refresh & lifetime

Re-query when fresh numbers are needed; avoid holding instances long term. Use incremental collection patterns (closed bucket cursor) similar to aggregate usage.

Reconciliation & late adjustments

Periodically re-query the most recent closed bucket(s) to pick up late accounting changes. Apply positive deltas only to your stored cumulative totals rather than overwriting historical values.

Note

Summed attributed usage may be less than (or equal to) aggregate usage; do not inflate attributed buckets to force equality.

  1. Query aggregate and attributed usage for the same aligned window.
  2. Compute per-id deltas for fully closed buckets.
  3. Track residual bytes (aggregate − sum(attributed)) separately.
  4. Persist new cursor boundary and cumulative totals.

Properties

AttributionId

Gets the Id of the app.

AttributionName

Gets the name of the app.

AttributionThumbnail

Gets the thumbnail of the app.

BytesReceived

Gets the number of bytes received by the app over the network.

BytesSent

Gets the number of bytes sent by the app over the network.

Applies to