Condividi tramite


Accessing network connection state and managing network costs (XAML)

Access network connectivity, cost, and usage information using classes in the Windows.Networking.Connectivity namespace in your Windows Runtime app.

When developing a Windows Runtime app that uses a network-based scenario, it is critical that the app demonstrate an awareness of network availability, which networks are preferred in the current environment, and any costs associated with network use. The Windows Runtime provides a set of APIs that allow an app to retrieve network connectivity information. This allows an app take appropriate action when operating in challenging network conditions or when operating over networks with data plan limits and metered network costs.

The topics in this section demonstrate how to access connectivity information and react to network state change and metered network scenarios. For additional code examples, download the Network information sample.

In This Section

Topic Description
How to retrieve network connection information

Retrieve and display network connectivity and cost information for a connection.

How to manage network connection events and changes in availability

Register for connection state change event notifications and provides app behavior recommendations for enabling your app to use this information.

How to manage metered network cost constraints

Maintain awareness of network connection cost or data plan status changes and enable your app to use this information to avoid incurring additional costs for roaming or exceeding a specified data transfer limit.

How to retrieve network adapter and locality information

Retrieve and display connection usage information for a specific period of time.

How to retrieve network connection usage data

Enumerate LAN identifiers and retrieve location information for network adapters supporting established connections.

 

Other

Roadmap for Windows Runtime apps using C# or Visual Basic

Roadmap for Windows Runtime apps using C++

Reference

Windows.Networking.Connectivity

Samples

Network information sample

Network status background sample