Connection​Profile Connection​Profile Connection​Profile Connection​Profile Class

Definition

Some information relates to pre-released product which may be substantially modified before it’s commercially released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Prerelease APIs are identified by a Prerelease label.

[Contains prerelease APIs.]
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// You can use this class in JavaScript.
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 : PlatForm::Boolean IsWlanConnectionProfile { get; }public bool IsWlanConnectionProfile { get; }Public ReadOnly Property IsWlanConnectionProfile As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

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

See Also

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 : PlatForm::Boolean IsWwanConnectionProfile { get; }public bool IsWwanConnectionProfile { get; }Public ReadOnly Property IsWwanConnectionProfile As bool// You can use this property in JavaScript.
Value
PlatForm::Boolean bool bool bool

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

See Also

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 NetworkAdapter// You can use this property in JavaScript.
Value
NetworkAdapter NetworkAdapter NetworkAdapter NetworkAdapter

The network adapter object.

NetworkSecuritySettings NetworkSecuritySettings NetworkSecuritySettings NetworkSecuritySettings

Retrieves the security settings for the network.

public : NetworkSecuritySettings NetworkSecuritySettings { get; }public NetworkSecuritySettings NetworkSecuritySettings { get; }Public ReadOnly Property NetworkSecuritySettings As NetworkSecuritySettings// You can use this property in JavaScript.

ProfileName ProfileName ProfileName ProfileName

Gets the name of the connection profile.

public : PlatForm::String ProfileName { get; }public string ProfileName { get; }Public ReadOnly Property ProfileName As string// You can use this property in JavaScript.
Value
PlatForm::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 Nullable<Guid> ServiceProviderGuid { get; }Public ReadOnly Property ServiceProviderGuid As Nullable<Guid>// You can use this property in JavaScript.
Value
IReference<PlatForm::Guid> Nullable<Guid> Nullable<Guid> Nullable<Guid>

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 WlanConnectionProfileDetails// You can use this property in JavaScript.
Value
WlanConnectionProfileDetails WlanConnectionProfileDetails WlanConnectionProfileDetails WlanConnectionProfileDetails

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

See Also

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 WwanConnectionProfileDetails// You can use this property in JavaScript.
Value
WwanConnectionProfileDetails WwanConnectionProfileDetails WwanConnectionProfileDetails WwanConnectionProfileDetails

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

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<IReadOnlyList<AttributedNetworkUsage>> GetAttributedNetworkUsageAsync(DateTimeOffset startTime, DateTimeOffset endTime, NetworkUsageStates states)Public Function GetAttributedNetworkUsageAsync(startTime As DateTimeOffset, endTime As DateTimeOffset, states As NetworkUsageStates) As IAsyncOperation( Of IReadOnlyListAttributedNetworkUsage )// You can use this method in JavaScript.
Parameters
startTime
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

The start time of the usage window.

endTime
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

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
IAsyncOperation<IVectorView<AttributedNetworkUsage>> IAsyncOperation<IReadOnlyList<AttributedNetworkUsage>> IAsyncOperation<IReadOnlyList<AttributedNetworkUsage>> IAsyncOperation<IReadOnlyList<AttributedNetworkUsage>>

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.

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

Gets the cost information for the connection.

public : ConnectionCost GetConnectionCost()public ConnectionCost GetConnectionCost()Public Function GetConnectionCost() As ConnectionCost// You can use this method in JavaScript.
Returns

The cost information for the connection.

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<IReadOnlyList<ConnectivityInterval>> GetConnectivityIntervalsAsync(DateTimeOffset startTime, DateTimeOffset endTime, NetworkUsageStates states)Public Function GetConnectivityIntervalsAsync(startTime As DateTimeOffset, endTime As DateTimeOffset, states As NetworkUsageStates) As IAsyncOperation( Of IReadOnlyListConnectivityInterval )// You can use this method in JavaScript.
Parameters
startTime
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

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

endTime
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

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
IAsyncOperation<IVectorView<ConnectivityInterval>> IAsyncOperation<IReadOnlyList<ConnectivityInterval>> IAsyncOperation<IReadOnlyList<ConnectivityInterval>> IAsyncOperation<IReadOnlyList<ConnectivityInterval>>

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 DataPlanStatus// You can use this method in JavaScript.
Returns

Current data plan status information.

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 DomainConnectivityLevel// You can use this method in JavaScript.
Returns

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

See Also

GetLocalUsage(DateTime, DateTime) 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(DateTimeOffset StartTime, DateTimeOffset EndTime)Public Function GetLocalUsage(StartTime As DateTimeOffset, EndTime As DateTimeOffset) As DataUsage// You can use this method in JavaScript.
Parameters
StartTime
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

The start date/time for the usage data request.

EndTime
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

The end date/time for the usage data request.

Returns

The requested local data usage information.

Remarks

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

See Also

GetLocalUsage(DateTime, DateTime, RoamingStates) 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(DateTimeOffset StartTime, DateTimeOffset EndTime, RoamingStates States)Public Function GetLocalUsage(StartTime As DateTimeOffset, EndTime As DateTimeOffset, States As RoamingStates) As DataUsage// You can use this method in JavaScript.
Parameters
StartTime
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

The start date/time for the usage data request.

EndTime
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

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.

Remarks

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

See Also

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 NetworkConnectivityLevel// You can use this method in JavaScript.
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<PlatForm::String> GetNetworkNames()public IReadOnlyList<string> GetNetworkNames()Public Function GetNetworkNames() As IReadOnlyList( Of string )// You can use this method in JavaScript.
Returns
IVectorView<PlatForm::String> IReadOnlyList<string> IReadOnlyList<string> IReadOnlyList<string>

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<IReadOnlyList<NetworkUsage>> GetNetworkUsageAsync(DateTimeOffset startTime, DateTimeOffset endTime, DataUsageGranularity granularity, NetworkUsageStates states)Public Function GetNetworkUsageAsync(startTime As DateTimeOffset, endTime As DateTimeOffset, granularity As DataUsageGranularity, states As NetworkUsageStates) As IAsyncOperation( Of IReadOnlyListNetworkUsage )// You can use this method in JavaScript.
Parameters
startTime
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

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

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
IAsyncOperation<IVectorView<NetworkUsage>> IAsyncOperation<IReadOnlyList<NetworkUsage>> IAsyncOperation<IReadOnlyList<NetworkUsage>> IAsyncOperation<IReadOnlyList<NetworkUsage>>

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.

See Also

GetProviderNetworkUsageAsync(DateTime, DateTime, NetworkUsageStates) GetProviderNetworkUsageAsync(DateTime, DateTime, NetworkUsageStates) GetProviderNetworkUsageAsync(DateTime, DateTime, NetworkUsageStates) GetProviderNetworkUsageAsync(DateTime, DateTime, NetworkUsageStates)

Prerelease. Returns the bytes sent and bytes received for each MCC and MNC combination (the combination is represented by a ProviderId ).

public : IAsyncOperation<IVectorView<ProviderNetworkUsage>> GetProviderNetworkUsageAsync(DateTime startTime, DateTime endTime, NetworkUsageStates states)public IAsyncOperation<IReadOnlyList<ProviderNetworkUsage>> GetProviderNetworkUsageAsync(DateTimeOffset startTime, DateTimeOffset endTime, NetworkUsageStates states)Public Function GetProviderNetworkUsageAsync(startTime As DateTimeOffset, endTime As DateTimeOffset, states As NetworkUsageStates) As IAsyncOperation( Of IReadOnlyListProviderNetworkUsage )// You can use this method in JavaScript.
Parameters
startTime
DateTime DateTimeOffset DateTimeOffset DateTimeOffset

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

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
IAsyncOperation<IVectorView<ProviderNetworkUsage>> IAsyncOperation<IReadOnlyList<ProviderNetworkUsage>> IAsyncOperation<IReadOnlyList<ProviderNetworkUsage>> IAsyncOperation<IReadOnlyList<ProviderNetworkUsage>>

Returns a single object containing the bytes send and bytes received for the ProviderId.

Additional features and requirements
Device family
Windows 10 Insider Preview (introduced v10.0.16225.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v5)
See Also

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 Nullable<byte> GetSignalBars()Public Function GetSignalBars() As Nullable( Of byte )// You can use this method in JavaScript.
Returns
IReference<byte> Nullable<byte> Nullable<byte> Nullable<byte>

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