Skip to content

Latest commit

 

History

History
36 lines (25 loc) · 2.3 KB

deviceinformation_createwatcher_4958831.md

File metadata and controls

36 lines (25 loc) · 2.3 KB
-api-id -api-type
M:Windows.Devices.Enumeration.DeviceInformation.CreateWatcher(System.String)
winrt method

Windows.Devices.Enumeration.DeviceInformation.CreateWatcher

-description

Creates a DeviceWatcher for devices matching the specified Advanced Query Syntax (AQS) string.

-parameters

-param aqsFilter

An AQS string that filters the DeviceInformation objects to enumerate. Typically this string is retrieved from the GetDeviceSelector method of a class that interacts with devices. For example, GetDeviceSelector retrieves the string for the StorageDevice class.

-returns

The created DeviceWatcher.

-remarks

Note

This overload is not available from JavaScript. To create a DeviceWatcher from an AQS string in JavaScript, use the CreateWatcher(String, IIterable_1) overload and pass null as the second parameter.

The DeviceWatcher first performs an initial enumeration of devices, raising an Added event for each device that it finds, and raising an EnumerationCompleted event when the initial enumeration is complete. After the initial enumeration is complete, it raises events when a device is added, deleted, or updated.

Note

An app must subscribe to all of the added, removed, and updated events to be notified when there are device additions, removals or updates. If an app handles only the added event, it will not receive an update if a device is added to the system after the initial device enumeration completes.

See the DeviceWatcher class for an example.

-examples

-see-also

CreateWatcher, CreateWatcher(DeviceClass), CreateWatcher(String, IIterable_1)