public class AndroidAccelerometer
extends java.lang.Object
implements android.hardware.SensorEventListener
Constructor and Description |
---|
AndroidAccelerometer() |
Modifier and Type | Method and Description |
---|---|
Acceleration |
getAcceleration()
Returns an Acceleration object representing acceleration in X, Y and Z axes.
|
DistanceUnit |
getDistanceUnit()
Returns the DistanceUnit being used.
|
double |
getX()
Returns the acceleration in the x-axis.
|
double |
getY()
Returns the acceleration in the y-axis.
|
double |
getZ()
Returns the acceleration in the z-axis.
|
boolean |
isAvailable()
Returns true if the Android device has a accelerometer.
|
void |
onAccuracyChanged(android.hardware.Sensor sensor,
int accuracy) |
void |
onSensorChanged(android.hardware.SensorEvent sensorEvent) |
void |
setDistanceUnit(DistanceUnit distanceUnit)
Sets the DistanceUnit to be used.
|
void |
startListening()
Start listening to events from the Android accelerometer.
|
void |
stopListening()
Stop listening to events from the Android accelerometer.
|
public void onAccuracyChanged(android.hardware.Sensor sensor, int accuracy)
onAccuracyChanged
in interface android.hardware.SensorEventListener
public void onSensorChanged(android.hardware.SensorEvent sensorEvent)
onSensorChanged
in interface android.hardware.SensorEventListener
public void setDistanceUnit(DistanceUnit distanceUnit)
public DistanceUnit getDistanceUnit()
public double getX()
public double getY()
public double getZ()
public Acceleration getAcceleration()
public boolean isAvailable()
public void startListening()
public void stopListening()