Skip to content

Proximity Sensor

Non-Visible component
Category Requires Version
Sensors API 19, Android 4.4 - 4.4.4 KitKat 1

Overview

Non-visible component that can measures the proximity of an object in cm relative to the view screen of a device. This sensor is typically used to determine whether a handset is being held up to a persons ear; i.e. lets you determine how far away an object is from a device. Many devices return the absolute distance, in cm, but some return only near and far values. In this case, the sensor usually reports its maximum range value in the far state and a lesser value in the near state.

Events

Proximity Changed

Triggered when distance (in cm) of the object to the device changes.

Params
distance Number

Properties

Available

Boolean ➖ Read - Blocks

Reports whether or not the device has a proximity sensor

Distance

Number ➖ Read - Blocks

Returns the distance from the object to the device

Enabled

Boolean Default: True ➖ Read Write - Designer Blocks

If true, the sensor will generate events. Otherwise, no eventsare generated .

Keep Running When On Pause

Boolean Default: False ➖ Read Write - Designer Blocks

Returns value of keepRunningWhenOnPause

Maximum Range

Number ➖ Read - Blocks

Reports the Maximum Range of the device's ProximitySensor


Last update: January 27, 2020