Last Updated On 2021-07-16
Version 1MinSDK 7Tutorial Video
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.
You can set the below properties in the UI part of the builder.
- Enabled - it's a boolean value which is set to true by default.
- KeepRunningWhenOnPause - it's a boolean value which is set to false by default.
You can set the below blocks properties in the blocks section of the builder.
Reports whether or not the device has a proximity sensor.
Returns the distance from the object to the device
If true, the sensor will generate events. Otherwise, no events are generated.
Returns value of keepRunningWhenOnPause
Reports the Maximum Range of the device's ProximitySensor
You can set the below event blocks in the blocks section of the builder.
Triggered when distance (in cm) of the object to the device changes.