ConnectionProfile ConnectionProfile ConnectionProfile ConnectionProfile Class

Definition

Represents a network connection, which includes either the currently connected network or prior network connections. Provides information about the connection status and connectivity statistics.

public sealed class ConnectionProfilepublic sealed class ConnectionProfilePublic NotInheritable Class ConnectionProfilepublic sealed class ConnectionProfile
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The following example function demonstrates how retrieve data from a ConnectionProfile.

function getConnectionProfileInfo(connectionProfile) {

     returnString += "Connection Cost Information:\n\r";
     returnString += "===============\n\r";
     var connectionCost = connectionProfile.getConnectionCost();
     returnString += "Cost Type: " + getCostType(connectionCost.networkCostType) + "\n\r";
     returnString += "Roaming: " + connectionCost.roaming + "\n\r";
     returnString += "Over Datalimit: " + connectionCost.overDataLimit + "\n\r";
     returnString += "Approaching Datalimit: " + connectionCost.approachingDataLimit + "\n\r";
}

For more examples of how these class methods are implemented to access connection information, see Quickstart: Retrieving network connection information.

Properties

IsWlanConnectionProfile IsWlanConnectionProfile IsWlanConnectionProfile IsWlanConnectionProfile

Gets a value that indicates if connection profile is a WLAN (WiFi) connection. This determines whether or not WlanConnectionProfileDetails is null.

public bool IsWlanConnectionProfile { get; }public bool IsWlanConnectionProfile { get; }Public ReadOnly Property IsWlanConnectionProfile As boolpublic bool IsWlanConnectionProfile { get; }
Value
bool bool bool bool

Indicates if the connection profile represents a WLAN (WiFi) connection.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

IsWwanConnectionProfile IsWwanConnectionProfile IsWwanConnectionProfile IsWwanConnectionProfile

Gets a value that indicates if connection profile is a WWAN (mobile) connection. This determines whether or not WwanConnectionProfileDetails is null.

public bool IsWwanConnectionProfile { get; }public bool IsWwanConnectionProfile { get; }Public ReadOnly Property IsWwanConnectionProfile As boolpublic bool IsWwanConnectionProfile { get; }
Value
bool bool bool bool

Indicates if the connection profile represents a WWAN (mobile) connection.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

NetworkAdapter NetworkAdapter NetworkAdapter NetworkAdapter

Gets the object representing the network adapter providing connectivity for the connection.

public NetworkAdapter NetworkAdapter { get; }public NetworkAdapter NetworkAdapter { get; }Public ReadOnly Property NetworkAdapter As NetworkAdapterpublic NetworkAdapter NetworkAdapter { get; }
Value
NetworkAdapter NetworkAdapter NetworkAdapter NetworkAdapter

The network adapter object.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

NetworkSecuritySettings NetworkSecuritySettings NetworkSecuritySettings NetworkSecuritySettings

Retrieves the security settings for the network.

public NetworkSecuritySettings NetworkSecuritySettings { get; }public NetworkSecuritySettings NetworkSecuritySettings { get; }Public ReadOnly Property NetworkSecuritySettings As NetworkSecuritySettingspublic NetworkSecuritySettings NetworkSecuritySettings { get; }
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

ProfileName ProfileName ProfileName ProfileName

Gets the name of the connection profile.

public string ProfileName { get; }public string ProfileName { get; }Public ReadOnly Property ProfileName As stringpublic string ProfileName { get; }
Value
string string string string

The name of the connection profile.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

ServiceProviderGuid ServiceProviderGuid ServiceProviderGuid ServiceProviderGuid

Gets the ID of the network operator who provisioned the connection profile.

public IReference<Guid> ServiceProviderGuid { get; }public IReference<Guid> ServiceProviderGuid { get; }Public ReadOnly Property ServiceProviderGuid As IReference<Guid>public IReference<Guid> ServiceProviderGuid { get; }
Value

The network operator ID.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

WlanConnectionProfileDetails WlanConnectionProfileDetails WlanConnectionProfileDetails WlanConnectionProfileDetails

Gets a WlanConnectionProfileDetails object that provides a method for retrieving information specific to a WLAN (WiFi) connection.

public WlanConnectionProfileDetails WlanConnectionProfileDetails { get; }public WlanConnectionProfileDetails WlanConnectionProfileDetails { get; }Public ReadOnly Property WlanConnectionProfileDetails As WlanConnectionProfileDetailspublic WlanConnectionProfileDetails WlanConnectionProfileDetails { get; }
Value
WlanConnectionProfileDetails WlanConnectionProfileDetails WlanConnectionProfileDetails WlanConnectionProfileDetails

Defines a method to access information specific to a WLAN connection.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

WwanConnectionProfileDetails WwanConnectionProfileDetails WwanConnectionProfileDetails WwanConnectionProfileDetails

Gets a WwanConnectionProfileDetails object containing the properties and methods used to retrieve information specific to mobile broadband connections.

public WwanConnectionProfileDetails WwanConnectionProfileDetails { get; }public WwanConnectionProfileDetails WwanConnectionProfileDetails { get; }Public ReadOnly Property WwanConnectionProfileDetails As WwanConnectionProfileDetailspublic WwanConnectionProfileDetails WwanConnectionProfileDetails { get; }
Value
WwanConnectionProfileDetails WwanConnectionProfileDetails WwanConnectionProfileDetails WwanConnectionProfileDetails

Defines methods and properties used to retrieve information specific to a mobile broadband connection.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Methods

GetAttributedNetworkUsageAsync(DateTime, DateTime, NetworkUsageStates) GetAttributedNetworkUsageAsync(DateTime, DateTime, NetworkUsageStates) GetAttributedNetworkUsageAsync(DateTime, DateTime, NetworkUsageStates) GetAttributedNetworkUsageAsync(DateTime, DateTime, NetworkUsageStates)

Gets network usage data for each individual application. This method is only supported in a Windows Phone Store app.

public IAsyncOperation<IVectorView<AttributedNetworkUsage>> GetAttributedNetworkUsageAsync(DateTime startTime, DateTime endTime, NetworkUsageStates states)public IAsyncOperation<IVectorView<AttributedNetworkUsage>> GetAttributedNetworkUsageAsync(DateTime startTime, DateTime endTime, NetworkUsageStates states)Public Function GetAttributedNetworkUsageAsync(startTime As DateTime, endTime As DateTime, states As NetworkUsageStates) As IAsyncOperation( Of IVectorViewAttributedNetworkUsage )public IAsyncOperation<IVectorView<AttributedNetworkUsage>> GetAttributedNetworkUsageAsync(DateTime startTime, DateTime endTime, NetworkUsageStates states)
Parameters
startTime
DateTime DateTime DateTime DateTime

The start time of the usage window.

endTime
DateTime DateTime DateTime DateTime

The end time of the usage window.

states
NetworkUsageStates NetworkUsageStates NetworkUsageStates NetworkUsageStates

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

Returns

When the method completes, it returns a list of AttributedNetworkUsage objects, which indicate the sent and received values, in bytes, and the total amount of time the app was connected during the corresponding time interval.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)
Capabilities
networkDataPlanProvisioning

Remarks

Note

Data usage tracking is not supported when an app is run on the emulator under Microsoft Visual Studio 2013 Update 2 instead of an actual device. As a result, the GetAttributedNetworkUsageAsync(DateTime, DateTime, NetworkUsageStates) method in a Windows Phone Store app will fail when run on the emulator.

GetConnectionCost() GetConnectionCost() GetConnectionCost() GetConnectionCost()

Gets the cost information for the connection.

public ConnectionCost GetConnectionCost()public ConnectionCost GetConnectionCost()Public Function GetConnectionCost() As ConnectionCostpublic ConnectionCost GetConnectionCost()
Returns

The cost information for the connection.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

GetConnectivityIntervalsAsync(DateTime, DateTime, NetworkUsageStates) GetConnectivityIntervalsAsync(DateTime, DateTime, NetworkUsageStates) GetConnectivityIntervalsAsync(DateTime, DateTime, NetworkUsageStates) GetConnectivityIntervalsAsync(DateTime, DateTime, NetworkUsageStates)

Gets a list of ConnectivityInterval objects, which indicate the timestamp for when the network connection began, and a time-span for the duration of that connection.

public IAsyncOperation<IVectorView<ConnectivityInterval>> GetConnectivityIntervalsAsync(DateTime startTime, DateTime endTime, NetworkUsageStates states)public IAsyncOperation<IVectorView<ConnectivityInterval>> GetConnectivityIntervalsAsync(DateTime startTime, DateTime endTime, NetworkUsageStates states)Public Function GetConnectivityIntervalsAsync(startTime As DateTime, endTime As DateTime, states As NetworkUsageStates) As IAsyncOperation( Of IVectorViewConnectivityInterval )public IAsyncOperation<IVectorView<ConnectivityInterval>> GetConnectivityIntervalsAsync(DateTime startTime, DateTime endTime, NetworkUsageStates states)
Parameters
startTime
DateTime DateTime DateTime DateTime

The start time over which to retrieve data. Can be no more than 60 days prior to the current time.

endTime
DateTime DateTime DateTime DateTime

The end time over which to retrieve data.

states
NetworkUsageStates NetworkUsageStates NetworkUsageStates NetworkUsageStates

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

Returns

When the method completes, it returns a list of ConnectivityInterval objects, which indicate the start time and duration for the current or prior connections.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

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

GetDataPlanStatus() GetDataPlanStatus() GetDataPlanStatus() GetDataPlanStatus()

Gets the current status of the data plan associated with the connection.

public DataPlanStatus GetDataPlanStatus()public DataPlanStatus GetDataPlanStatus()Public Function GetDataPlanStatus() As DataPlanStatuspublic DataPlanStatus GetDataPlanStatus()
Returns

Current data plan status information.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

GetDomainConnectivityLevel() GetDomainConnectivityLevel() GetDomainConnectivityLevel() GetDomainConnectivityLevel()

Gets the current domain authentication status for a network connection. Possible values are defined by DomainConnectivityLevel.

public DomainConnectivityLevel GetDomainConnectivityLevel()public DomainConnectivityLevel GetDomainConnectivityLevel()Public Function GetDomainConnectivityLevel() As DomainConnectivityLevelpublic DomainConnectivityLevel GetDomainConnectivityLevel()
Returns

A value indicating the authentication status for a connection to a network domain.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

GetLocalUsage(DateTime, DateTime) GetLocalUsage(DateTime, DateTime) GetLocalUsage(DateTime, DateTime) GetLocalUsage(DateTime, DateTime)

Note

GetLocalUsage(DateTime, DateTime) may be altered or unavailable for releases after Windows 8.1. Instead, use GetNetworkUsageAsync(DateTime, DateTime, DataUsageGranularity, NetworkUsageStates)

Gets the estimated data usage for a connection during over a specific period of time.

public DataUsage GetLocalUsage(DateTime StartTime, DateTime EndTime)public DataUsage GetLocalUsage(DateTime StartTime, DateTime EndTime)Public Function GetLocalUsage(StartTime As DateTime, EndTime As DateTime) As DataUsagepublic DataUsage GetLocalUsage(DateTime StartTime, DateTime EndTime)
Parameters
StartTime
DateTime DateTime DateTime DateTime

The start date/time for the usage data request.

EndTime
DateTime DateTime DateTime DateTime

The end date/time for the usage data request.

Returns

The requested local data usage information.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

For an example of how this method is used, see How to retrieve connection usage data for a specific period of time.

GetLocalUsage(DateTime, DateTime, RoamingStates) GetLocalUsage(DateTime, DateTime, RoamingStates) GetLocalUsage(DateTime, DateTime, RoamingStates) GetLocalUsage(DateTime, DateTime, RoamingStates)

Gets the estimated data usage for a connection over a specific period of time and roaming state.

public DataUsage GetLocalUsage(DateTime StartTime, DateTime EndTime, RoamingStates States)public DataUsage GetLocalUsage(DateTime StartTime, DateTime EndTime, RoamingStates States)Public Function GetLocalUsage(StartTime As DateTime, EndTime As DateTime, States As RoamingStates) As DataUsagepublic DataUsage GetLocalUsage(DateTime StartTime, DateTime EndTime, RoamingStates States)
Parameters
StartTime
DateTime DateTime DateTime DateTime

The start date/time for the usage data request.

EndTime
DateTime DateTime DateTime DateTime

The end date/time for the usage data request.

States
RoamingStates RoamingStates RoamingStates RoamingStates

The roaming state to scope the request to.

Returns

The requested local data usage information.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

For an example of how this method is used, see How to retrieve connection usage data for a specific period of time.

GetNetworkConnectivityLevel() GetNetworkConnectivityLevel() GetNetworkConnectivityLevel() GetNetworkConnectivityLevel()

Gets the network connectivity level for this connection. This value indicates what network resources, if any, are currently available.

public NetworkConnectivityLevel GetNetworkConnectivityLevel()public NetworkConnectivityLevel GetNetworkConnectivityLevel()Public Function GetNetworkConnectivityLevel() As NetworkConnectivityLevelpublic NetworkConnectivityLevel GetNetworkConnectivityLevel()
Returns
Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

The GetNetworkConnectivityLevel() method may take time in some cases to determine the current value of the network connectivity level. The recommended process for determining the network connectivity level is to register a handler for the NetworkStatusChanged event on the NetworkInformation class. When a notification is received of a network status change, obtain the new connectivity level by calling the GetNetworkConnectivityLevel() method on the profile returned by the GetInternetConnectionProfile() method. The returned network connectivity level can then be stored for later use when needed. This also ensures that the correct ConnectionProfile is checked.

GetNetworkNames() GetNetworkNames() GetNetworkNames() GetNetworkNames()

Retrieves names associated with the network with which the connection is currently established.

public IVectorView<string> GetNetworkNames()public IVectorView<string> GetNetworkNames()Public Function GetNetworkNames() As IVectorView( Of string )public IVectorView<string> GetNetworkNames()
Returns

An array of string values representing friendly names used to identify the local endpoint.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

GetNetworkUsageAsync(DateTime, DateTime, DataUsageGranularity, NetworkUsageStates) GetNetworkUsageAsync(DateTime, DateTime, DataUsageGranularity, NetworkUsageStates) GetNetworkUsageAsync(DateTime, DateTime, DataUsageGranularity, NetworkUsageStates) GetNetworkUsageAsync(DateTime, DateTime, DataUsageGranularity, NetworkUsageStates)

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 IAsyncOperation<IVectorView<NetworkUsage>> GetNetworkUsageAsync(DateTime startTime, DateTime endTime, DataUsageGranularity granularity, NetworkUsageStates states)public IAsyncOperation<IVectorView<NetworkUsage>> GetNetworkUsageAsync(DateTime startTime, DateTime endTime, DataUsageGranularity granularity, NetworkUsageStates states)Public Function GetNetworkUsageAsync(startTime As DateTime, endTime As DateTime, granularity As DataUsageGranularity, states As NetworkUsageStates) As IAsyncOperation( Of IVectorViewNetworkUsage )public IAsyncOperation<IVectorView<NetworkUsage>> GetNetworkUsageAsync(DateTime startTime, DateTime endTime, DataUsageGranularity granularity, NetworkUsageStates states)
Parameters
startTime
DateTime DateTime DateTime DateTime

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
DateTime DateTime DateTime DateTime

The end time over which to retrieve data.

granularity
DataUsageGranularity DataUsageGranularity DataUsageGranularity 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
NetworkUsageStates NetworkUsageStates NetworkUsageStates 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.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

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

GetSignalBars() GetSignalBars() GetSignalBars() GetSignalBars()

Gets a value that indicates the current number of signal bars displayed by the Windows UI for the connection.

public IReference<byte> GetSignalBars()public IReference<byte> GetSignalBars()Public Function GetSignalBars() As IReference( Of byte )public IReference<byte> GetSignalBars()
Returns

An integer value within a range of 0-5 that corresponds to the number of signal bars displayed by the UI.

Attributes
Additional features and requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)