ProximityDevice.DeviceArrived | devicearrived Event

Tritt ein, wenn ein Gerät in den Nahbereich kommt.

Syntax


function onDeviceArrived(eventArgs) { /* Ihr Code */ }
 
// addEventListener syntax
proximityDevice.addEventListener("devicearrived", onDeviceArrived);
proximityDevice.removeEventListener("devicearrived", onDeviceArrived);
 
- or -

proximityDevice.ondevicearrived = onDeviceArrived;


Ereignisinformationen

Delegat DeviceArrivedEventHandler

Beispiele


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 />";
}


Anforderungen

Mindestens unterstützter Client

Windows 8

Mindestens unterstützter Server

Windows Server 2012

Mindestens unterstütztes Telefon

Windows Phone 8

Namespace

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

Metadaten

Windows.winmd

Capabilities

proximity
ID_CAP_PROXIMITY [Windows Phone]

Siehe auch

ProximityDevice
Nähe und Tippen (JavaScript)
Nähe und Tippen (C#/VB/C++)
Beispiele
Nähebeispiel

 

 

Anzeigen:
© 2014 Microsoft