ProximityDevice.GetDeviceSelector Method


Returns the class selection string that you can use to enumerate proximity devices.

 static Platform::String ^ GetDeviceSelector();
 static winrt::hstring GetDeviceSelector();
public static string GetDeviceSelector();
function getDeviceSelector()
Public Shared Function GetDeviceSelector () As String



The class selection string for proximity devices.

Windows 10 requirements

App capabilities
ID_CAP_PROXIMITY [Windows Phone] proximity ID_CAP_PROXIMITY [Windows Phone]


Windows.Networking.Proximity.ProximityDevice proximityDevice;

private async void InitializeProximity()
    string selectorString = Windows.Networking.Proximity.ProximityDevice.GetDeviceSelector();

    var deviceInfoCollection =
        await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(selectorString, null);

        if (deviceInfoCollection.Count == 0)
            StatusTextBlock.Text = "No proximity devices found.";
            StatusTextBlock.Text = "Proximity Device id = " + deviceInfoCollection[0].Id;
            proximityDevice =
var proximityDevice;

function initializeProximity() {
    var selectorString = Windows.Networking.Proximity.ProximityDevice.getDeviceSelector();
    var propertiesToRetrieve = new Array();
    propertiesToRetrieve.push("{FB3842CD-9E2A-4F83-8FCC-4B0761139AE9} 2");

    Windows.Devices.Enumeration.DeviceInformation.findAllAsync(selectorString, propertiesToRetrieve).done(
        function (deviceInfoCollection) {
            if (deviceInfoCollection.size == 0) {
                statusDiv.innerHTML = "No proximity devices found.";
            } else {
                statusDiv.innerHTML = "Proximity Device id = " + deviceInfoCollection[0].id;
                proximityDevice =
Private proximityDevice As Windows.Networking.Proximity.ProximityDevice

Private Async Sub InitializeProximity()
    Dim selectorString = Windows.Networking.Proximity.ProximityDevice.GetDeviceSelector()

    Dim deviceInfoCollection =
        Await Windows.Devices.Enumeration.DeviceInformation.FindAllAsync(selectorString, {"{FB3842CD-9E2A-4F83-8FCC-4B0761139AE9} 2"})

    If deviceInfoCollection.Count = 0 Then
        StatusTextBlock.Text = "No proximity devices found."
        StatusTextBlock.Text = "Proximity Device id = " & deviceInfoCollection(0).Id
        proximityDevice =
    End If
End Sub


You can enumerate proximity devices by passing the class selection string returned by the GetDeviceSelector method to the FindAllAsync or CreateWatcher method.

If your computer supports Proximity and has an NFC device installed, which is commonly the case, then the GetDefault method will return the device that supports NFC. You can also determine whether your computer has an NFC device installed by querying the device information for the property "{FB3842CD-9E2A-4F83-8FCC-4B0761139AE9} 2". In the DeviceInformation.Properties object returned from the query the value for the "{FB3842CD-9E2A-4F83-8FCC-4B0761139AE9} 2" key contains and array of strings that describe the capabilities of the proximity device. If one of the strings is "StandardNfc", then the device supports NFC protocols such as NDEF. For more information on how to query for the properties of a device, see How to retrieve additional properties for a device or PnP object.

Applies to

See also