Skip to content

Proximity Sensor

Non-Visible component
Category Requires Version
Sensors API 21, Android 5.0 Lollipop 1


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.


Proximity Changed

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

distance Number



Boolean ➖ Read - Blocks

Reports whether or not the device has a proximity sensor


Number ➖ Read - Blocks

Returns the distance from the object to the device


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: November 9, 2022