public class MotionDetection
extends java.lang.Object
implements android.hardware.SensorEventListener
Modifier and Type | Class and Description |
---|---|
static interface |
MotionDetection.MotionDetectionListener |
class |
MotionDetection.Vector |
Modifier and Type | Field and Description |
---|---|
protected MotionDetection.Vector |
gravity |
Constructor and Description |
---|
MotionDetection() |
MotionDetection(double detectionThreshold,
int rateLimitSeconds) |
Modifier and Type | Method and Description |
---|---|
protected MotionDetection.Vector |
filter(android.hardware.SensorEvent sensorEvent)
filter
Taken straight from the google documentation for implementing a low pass
filter for filtering out gravity.
|
boolean |
isAvailable()
Is the required sensor available on this device?
|
protected void |
notifyListeners(double vector) |
void |
onAccuracyChanged(android.hardware.Sensor sensor,
int i) |
void |
onSensorChanged(android.hardware.SensorEvent sensorEvent)
Internal implementations of the SensorEventListener interface.
|
void |
purgeListeners()
purgeListeners
|
void |
registerListener(MotionDetection.MotionDetectionListener listener)
registerListener
|
void |
startListening()
Start processing sensor data.
|
void |
stopListening()
Stop processing sensor data.
|
protected MotionDetection.Vector gravity
public MotionDetection()
public MotionDetection(double detectionThreshold, int rateLimitSeconds)
protected MotionDetection.Vector filter(android.hardware.SensorEvent sensorEvent)
sensorEvent
- The sensor data spit out by android for the accelerometer.public void registerListener(MotionDetection.MotionDetectionListener listener)
public void purgeListeners()
public boolean isAvailable()
public void startListening()
public void stopListening()
protected void notifyListeners(double vector)
public void onSensorChanged(android.hardware.SensorEvent sensorEvent)
onSensorChanged
in interface android.hardware.SensorEventListener
public void onAccuracyChanged(android.hardware.Sensor sensor, int i)
onAccuracyChanged
in interface android.hardware.SensorEventListener