DeviceConnectionChangeTrigger DeviceConnectionChangeTrigger DeviceConnectionChangeTrigger Class


Represents a trigger that launches a background task when the connection status of a device changes.

public sealed class DeviceConnectionChangeTrigger : IBackgroundTrigger, IDeviceConnectionChangeTriggerpublic sealed class DeviceConnectionChangeTrigger : IBackgroundTrigger, IDeviceConnectionChangeTriggerPublic NotInheritable Class DeviceConnectionChangeTrigger Implements IBackgroundTrigger, IDeviceConnectionChangeTrigger
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)


CanMaintainConnection CanMaintainConnection CanMaintainConnection

Gets whether the system can maintain a connection to the specified device.

public bool CanMaintainConnection { get; }public bool CanMaintainConnection { get; }Public ReadOnly Property CanMaintainConnection As bool
bool bool bool

True if the system can maintain a connection to the specified device; Otherwise, false. If false, an attempt to register a trigger with MaintainConnection = true will throw an exception. The default value of this property is true for Bluetooth LE devices and false for all other device types.


DeviceId DeviceId DeviceId

Gets the device Id associated with the device.

public string DeviceId { get; }public string DeviceId { get; }Public ReadOnly Property DeviceId As string
string string string

The device Id associated with the device.



When monitoring Bluetooth LE devices, the DeviceId must reference an interface on the Bluetooth LE device object. The device Id in this case can be the values returned by the GetDeviceSelector. Alternatively, the DeviceId can reference an interface on a GattDeviceService object and valid values for the device Id is any value returned by GetDeviceSelectorFromShortId or GetDeviceSelectorFromUuid.

When monitoring other Bluetooth devices, the device Id can be any value returned by the GetDeviceSelector on RfCommDeviceService or BluetoothDevice.

MaintainConnection MaintainConnection MaintainConnection

Gets or sets whether the system should automatically attempt to keep the referenced device connected.

public bool MaintainConnection { get; set; }public bool MaintainConnection { get; set; }Public ReadWrite Property MaintainConnection As bool
bool bool bool

True of the system should try to keep the device connected; Otherwise, false. Default is false.



FromIdAsync(String) FromIdAsync(String) FromIdAsync(String)

Begins an asynchronous operation to get the DeviceConnectionChangeTrigger associated with the specified Id.

public static IAsyncOperation<DeviceConnectionChangeTrigger> FromIdAsync(String deviceId)public static IAsyncOperation<DeviceConnectionChangeTrigger> FromIdAsync(String deviceId)Public Static Function FromIdAsync(deviceId As String) As IAsyncOperation( Of DeviceConnectionChangeTrigger )
System.String System.String System.String

The device Id with which to find the associated trigger.


The DeviceConnectionChangeTrigger object associated with the specified device Id.