ProximitySensor ProximitySensor ProximitySensor ProximitySensor ProximitySensor Class

Definition

Provides an interface for a proximity sensor to determine whether or not an object is detected.

For an example implementation, see the proximity sensor sample.

public : sealed class ProximitySensor
struct winrt::Windows::Devices::Sensors::ProximitySensor
public sealed class ProximitySensor
Public NotInheritable Class ProximitySensor
// This class does not provide a public constructor.
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Version history

Windows version SDK version Value added
1511 10586 GetReadingsFromTriggerDetails

Properties

DeviceId DeviceId DeviceId DeviceId DeviceId

Gets the device identifier.

MaxDistanceInMillimeters MaxDistanceInMillimeters MaxDistanceInMillimeters MaxDistanceInMillimeters MaxDistanceInMillimeters

The largest distance where the proximity sensor can detect an object.

MinDistanceInMillimeters MinDistanceInMillimeters MinDistanceInMillimeters MinDistanceInMillimeters MinDistanceInMillimeters

The shortest distance where the proximity sensor can detect an object.

Methods

CreateDisplayOnOffController() CreateDisplayOnOffController() CreateDisplayOnOffController() CreateDisplayOnOffController() CreateDisplayOnOffController()

Creates a controller responsible for turning the display on or off based on the ProximitySensorReading.

FromId(String) FromId(String) FromId(String) FromId(String) FromId(String)

Obtains the proximity sensor from its identifier.

GetCurrentReading() GetCurrentReading() GetCurrentReading() GetCurrentReading() GetCurrentReading()

Gets the current reading for the proximity sensor.

GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector()

Gets the device selector.

GetReadingsFromTriggerDetails(SensorDataThresholdTriggerDetails) GetReadingsFromTriggerDetails(SensorDataThresholdTriggerDetails) GetReadingsFromTriggerDetails(SensorDataThresholdTriggerDetails) GetReadingsFromTriggerDetails(SensorDataThresholdTriggerDetails) GetReadingsFromTriggerDetails(SensorDataThresholdTriggerDetails)

Gets readings from the trigger details in background task.

Events

ReadingChanged ReadingChanged ReadingChanged ReadingChanged ReadingChanged

Occurs each time the proximity sensor reports a new value.