Sensor.setEnabled

Enable or disable a sensor.

All sensors are disabled by default, to avoid consuming too much battery power. Once a sensor is enabled, it starts sending events of the corresponding type.

This function does nothing if the sensor is unavailable.

class Sensor
static
void
setEnabled

Parameters

sensor Type

Sensor to enable

enabled bool

true to enable, false to disable

Meta