ProximityDevice.FromId | fromId method
Creates an instance of a ProximityDevice class and activates the specified proximity device interface.
Syntax
var proximityDevice = Windows.Networking.Proximity.ProximityDevice.fromId(deviceInterfaceId);
Parameters
- deviceInterfaceId
-
Type: String [JavaScript] | System.String [.NET] | Platform::String [C++]
The DeviceInformation Id of a proximity device.
Return value
Type: ProximityDevice
A new ProximityDevicethat uses the specified proximity device interface. Throws a System.IO.FileNotFoundException exception if the specified proximity device interface isunavailable.
Remarks
You can enumerate proximity devices by passing the class selection string returned by the GetDeviceSelector method to the FindAllAsync or CreateWatcher method. You can then use the resulting DeviceInformation Id value(s) to create an instance of a ProximityDevice using the FromId method.
Examples
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 = Windows.Networking.Proximity.ProximityDevice.fromId(deviceInfoCollection[0].id); } }); }
Requirements
|
Minimum supported client | Windows 8 |
|---|---|
|
Minimum supported server | Windows Server 2012 |
|
Minimum supported phone | Windows Phone 8 |
|
Namespace |
|
|
Metadata |
|
|
Capabilities |
|
See also
- ProximityDevice
- Proximity and Tapping (JavaScript)
- Proximity and Tapping (C#/VB/C++)
- Samples
- Proximity sample
Build date: 2/25/2013
