Sensor

public class Sensor

Class representing a sensor. Mirror off the one in Android without the final keyword.

Fields

TYPE_ACCELEROMETER

public static final int TYPE_ACCELEROMETER

A constant describing an accelerometer sensor type.

TYPE_ALL

public static final int TYPE_ALL

A constant describing all sensor types.

TYPE_AMBIENT_TEMPERATURE

public static final int TYPE_AMBIENT_TEMPERATURE

A constant describing an ambient temperature sensor type.

TYPE_GYROSCOPE

public static final int TYPE_GYROSCOPE

A constant describing a gyroscope sensor type.

TYPE_LIGHT

public static final int TYPE_LIGHT

A constant describing a light sensor type.

TYPE_MAGNETIC_FIELD

public static final int TYPE_MAGNETIC_FIELD

A constant describing a magnetic field sensor type.

TYPE_PRESSURE

public static final int TYPE_PRESSURE

A constant describing a pressure sensor type.

TYPE_RELATIVE_HUMIDITY

public static final int TYPE_RELATIVE_HUMIDITY

A constant describing a relative humidity sensor type.

TYPE_SIGNIFICANT_MOTION

public static final int TYPE_SIGNIFICANT_MOTION

A constant describing a significant motion sensor.

Methods

getIdentifier

public int getIdentifier()
Returns

The identifier of this sensor instance.

getMaxDelay

public int getMaxDelay()

This value is defined only for continuous and on-change sensors. It is the delay between two sensor events corresponding to the lowest frequency that this sensor supports. When lower frequencies are requested through registerListener() the events will be generated at this frequency instead.

Returns

The max delay for this sensor in microseconds.

getMaximumRange

public float getMaximumRange()
Returns

The maximum range of the sensor in the sensor’s unit.

getMinDelay

public int getMinDelay()
Returns

The minimum delay allowed between two events in microsecond or zero if this sensor only returns a value when the data it’s measuring changes.

getName

public String getName()
Returns

The name string of the sensor.

getPower

public float getPower()
Returns

The power in mA used by this sensor while in use

getResolution

public float getResolution()
Returns

The resolution of the sensor in the sensor’s unit.

getStringType

public String getStringType()
Returns

The type of this sensor as a string.

getType

public int getType()
Returns

The generic type of this sensor.

getVendor

public String getVendor()
Returns

The vendor string of this sensor.

getVersion

public int getVersion()
Returns

The version of the sensor’s module.