java.lang.Object | |
↳ | com.neomades.io.sensor.Sensor |
![]() |
Class representing a sensor. Use a getter from the SensorManager
to
get back a sensor.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | PERIOD_FASTEST | Gets sensor data as fast as possible. | |||||||||
int | PERIOD_GAME | Rate suitable for games. | |||||||||
int | PERIOD_LOW | Rate suitable for screen orientation changes. | |||||||||
int | PERIOD_NORMAL | Rate suitable for the user interface (Default). | |||||||||
int | TYPE_ACCELEROMETER | A constant describing an accelerometer sensor type. | |||||||||
int | TYPE_GYROSCOPE | A constant describing a gyroscope sensor type. | |||||||||
int | TYPE_MAGNETOMETER | A constant describing a magnetometer sensor type. |
Protected Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Sensor()
Sensor constructor.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int |
getType()
Gets the constant type corresponding to the Sensor.
| ||||||||||
boolean |
isActive()
Indicates whether sensor updates are currently happening.
| ||||||||||
void |
setListener(SensorListener listener)
Sets the listener allowing to receive notifications from the Sensor when
sensor values have changed.
| ||||||||||
void |
start(int period)
Starts data acquisition from the sensor.
| ||||||||||
void |
stop()
Stops data acquisition from the sensor.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Gets sensor data as fast as possible.
Rate suitable for games.
Rate suitable for screen orientation changes.
Rate suitable for the user interface (Default).
A constant describing an accelerometer sensor type.
A constant describing a gyroscope sensor type.
A constant describing a magnetometer sensor type.
Gets the constant type corresponding to the Sensor.
TYPE_ACCELEROMETER
TYPE_GYROSCOPE
TYPE_MAGNETOMETER
Indicates whether sensor updates are currently happening.
Sets the listener allowing to receive notifications from the Sensor when sensor values have changed.
Starts data acquisition from the sensor.
Becarefull when you give the speed rate as a parameter. For some devices the speed rate could be to hight compared to the performance of the embedded sensor leading to fatal error.
period | is the rate chosen for data's recording |
---|
Stops data acquisition from the sensor.