Windows.Networking.Proximity namespace

Expand
This topic has not yet been rated - Rate this topic

Windows.Networking.Proximity namespace

[This documentation is preliminary and is subject to change.]

Contains classes that support connections between devices that are within close range.

Members

The Windows.Networking.Proximity namespace has these types of members:

Classes

The Windows.Networking.Proximity namespace has these classes.

ClassDescription
ConnectionRequestedEventArgs Contains properties that are passed to an application with the ConnectionRequested event.
PeerFinder Enables you to discover another instance of your app on a nearby device and create a socket connection between the peer apps by using a tap gesture or by browsing.
PeerInformation Contains information that identifies a peer.
ProximityDevice Enables you to publish messages to proximate devices or subscribe to messages from proximate devices.
ProximityMessage Represents a message that's received from a subscription.
TriggeredConnectionStateChangedEventArgs Contains properties that the TriggeredConnectionStateChanged event passes to an application.

 

Delegates

The Windows.Networking.Proximity namespace has these delegates.

DelegateDescription
DeviceArrivedEventHandler Describes the method that handles the DeviceArrived event.
DeviceDepartedEventHandler Describes the method that handles the DeviceDeparted event.
MessageReceivedHandler Describes the method that will handle the event that's fired when a message that has been subscribed to has been received.
MessageTransmittedHandler Describes the method that will handle the event that's fired when a published message has been transmitted.

 

Enumerations

The Windows.Networking.Proximity namespace has these enumerations.

EnumerationDescription
PeerDiscoveryTypes Indicates which discovery options are available to use with the PeerFinder class.
TriggeredConnectState Indicates the current state of a connection to a peer application.

 

Remarks

You can use proximity to connect computers by using a simple tap gesture. If two computers come within 3 centimeters to4 centimeters of each other, or are tapped together, the operating system of each computer detects the other computer. You can then connect the two computers to share content or publish and subscribe to messages. Proximity also supports discovery of peer devices via Wifi-Direct.

Examples

This example shows how you can use the ProximityDevice class to determine when a device enters and leaves proximity.


function id(elementId) {
    return document.getElementById(elementId);
}

var proximityDevice;

function initializeProximityDevice() {
    proximityDevice = Windows.Networking.Proximity.ProximityDevice.getDefault();

    if (proximityDevice) {
        proximityDevice.addEventListener("devicearrived", proximityDeviceArrived);
        proximityDevice.addEventListener("devicedeparted", proximityDeviceDeparted);

        id("messageDiv").innerHTML += "Proximity device initialized.<br />";
    }
    else {
        id("messageDiv").innerHTML += "Failed to initialized proximity device.<br />";
    }
}

function proximityDeviceArrived(device) {
    id("messageDiv").innerHTML += "Proximate device arrived. id = " + device.deviceId + "<br />";
}

function proximityDeviceDeparted(device) {
    id("messageDiv").innerHTML += "Proximate device departed. id = " + device.deviceId + "<br />";
}


Requirements

Minimum supported client

Windows 8 Release Preview

Minimum supported server

Windows Server 2012

Namespace

Windows.Networking.Proximity
Windows::Networking::Proximity [C++]

Metadata

Windows.winmd

Capabilities

proximity

See also

Proximity and Tapping (JavaScript)
Proximity and Tapping (C#/VB/C++)
Samples
Proximity sample

 

 

Build date: 5/22/2012

Did you find this helpful?
(1500 characters remaining)
Community Additions ADD
Proximity is a new device type in Windows 8
Proximity is a new device type in Windows 8. One of the primary proximity technologies expected to be supported in Windows 8 is Near-field communications (NFC). If you do not have one of the slate PCs given out at the //build conference, you probably don’t have a Windows 8 compatible proximity device available. You can see more information about what you can do with proximity aware metro applications here: http://msdn.mic​rosoft.com/en-u​s/library/windo​ws/apps/hh46522​9(v=VS.85).aspx For information on how to write a driver for a proximity device go here: http://msdn.mic​rosoft.com/en-u​s/library/windo​ws/hardware/hh4​39292(v=VS.85).​aspx The sample proximity driver contained in the Windows 8 WDK can also serve as a simulator to enable proximity applications and experiences. Note that NXP is the only hardware vendor that has a publicly available proximity driver that is compatible with Windows 8. Others may become available in the coming months. -Mike L [MSFT]
1/15/2012
Please Provide Proximity Drivers
I'm with broody. I havea very common NFC reader (ACR-122T) and Windows 8 doesn't recognize it as a Proximity Device ! We need more drivers than the Samsung tablet you guys had at the Build event.
1/12/2012
What is a proximity device?
Is it Wifi? Bluetooth? NFC? OHHHH the suspense!!!
11/11/2011