ConnectionProfile ConnectionProfile ConnectionProfile ConnectionProfile Class

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

Syntax

Declaration

public sealed class ConnectionProfilepublic sealed class ConnectionProfilePublic NotInheritable Class ConnectionProfilepublic sealed class ConnectionProfile

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 summary

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

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

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

Retrieves the security settings for the network.

Gets the name of the connection profile.

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

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

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

Methods summary

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

Gets the cost information for the connection.

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.

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

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

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.

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

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

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

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.

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

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; }

    Property Value

    • bool
      bool
      bool
      bool

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

  • 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; }

    Property Value

    • bool
      bool
      bool
      bool

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

  • 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; }

    Property Value

  • 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; }

    Property Value

  • 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; }

    Property Value

    • string
      string
      string
      string

      The name of the connection profile.

  • 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; }

    Property Value

    • The network operator ID.

  • 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; }

    Property Value

  • 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; }

    Property Value

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

    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.

    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

  • 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

    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.

    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

  • 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

  • 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

    Returns

    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

    Returns

    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

    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.

  • 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

    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.

    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.

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute

Details

Assembly

Windows.Networking.Connectivity.dll