Connection​Profile Connection​Profile Connection​Profile 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 ConnectionProfile : IConnectionProfile, IConnectionProfile2, IConnectionProfile3public sealed class ConnectionProfile : IConnectionProfile, IConnectionProfile2, IConnectionProfile3Public NotInheritable Class ConnectionProfile Implements IConnectionProfile, IConnectionProfile2, IConnectionProfile3
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

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 bool
Value
bool bool bool

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

Attributes

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 bool
Value
bool bool bool

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

Attributes

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 NetworkAdapter
Value
NetworkAdapter NetworkAdapter NetworkAdapter

The network adapter object.

Attributes

NetworkSecuritySettings NetworkSecuritySettings NetworkSecuritySettings

Retrieves the security settings for the network.

public NetworkSecuritySettings NetworkSecuritySettings { get; }public NetworkSecuritySettings NetworkSecuritySettings { get; }Public ReadOnly Property NetworkSecuritySettings As NetworkSecuritySettings
Value
NetworkSecuritySettings NetworkSecuritySettings NetworkSecuritySettings

The current network security settings.

Attributes

ProfileName ProfileName ProfileName

Gets the name of the connection profile.

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

The name of the connection profile.

Attributes

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

The network operator ID.

Attributes

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 WlanConnectionProfileDetails
Value
WlanConnectionProfileDetails WlanConnectionProfileDetails WlanConnectionProfileDetails

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

Attributes

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 WwanConnectionProfileDetails
Value
WwanConnectionProfileDetails WwanConnectionProfileDetails WwanConnectionProfileDetails

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

Attributes

Methods

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 )
Parameters
startTime
DateTime DateTime DateTime

The start time of the usage window.

endTime
DateTime DateTime DateTime

The end time of the usage window.

states
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 method in a Windows Phone Store app will fail when run on the emulator.

GetConnectionCost() GetConnectionCost() GetConnectionCost()

Gets the cost information for the connection.

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

The cost information for the connection.

Attributes

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 )
Parameters
startTime
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

The end time over which to retrieve data.

states
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

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()

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

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

Current data plan status information.

Attributes

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 DomainConnectivityLevel
Returns

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

Attributes

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

Note

GetLocalUsage may be altered or unavailable for releases after Windows 8.1. Instead, use GetNetworkUsageAsync

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 DataUsage
Parameters
StartTime
DateTime DateTime DateTime

The start date/time for the usage data request.

EndTime
DateTime DateTime DateTime

The end date/time for the usage data request.

Returns

The requested local data usage information.

Attributes

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)

Note

GetLocalUsage may be altered or unavailable for releases after Windows 8.1. Instead, use GetNetworkUsageAsync

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 DataUsage
Parameters
StartTime
DateTime DateTime DateTime

The start date/time for the usage data request.

EndTime
DateTime DateTime DateTime

The end date/time for the usage data request.

States
RoamingStates RoamingStates RoamingStates

The roaming state to scope the request to.

Returns

The requested local data usage information.

Attributes

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()

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 NetworkConnectivityLevel
Returns
Attributes

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()

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 )
Returns

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

Attributes

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 )
Parameters
startTime
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

The end time over which to retrieve data.

granularity
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

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

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()

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 )
Returns

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

Attributes