public class ShakeDetector extends Object implements android.hardware.SensorEventListener
| Modifier and Type | Class and Description |
|---|---|
static interface |
ShakeDetector.Listener
Listens for shakes.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
SENSITIVITY_HARD |
static int |
SENSITIVITY_LIGHT |
static int |
SENSITIVITY_MEDIUM |
| Constructor and Description |
|---|
ShakeDetector(ShakeDetector.Listener listener) |
| Modifier and Type | Method and Description |
|---|---|
void |
onAccuracyChanged(android.hardware.Sensor sensor,
int accuracy) |
void |
onSensorChanged(android.hardware.SensorEvent event) |
void |
setSensitivity(int accelerationThreshold)
Sets the acceleration threshold sensitivity.
|
boolean |
start(android.hardware.SensorManager sensorManager)
Starts listening for shakes on devices with appropriate hardware.
|
void |
stop()
Stops listening.
|
public static final int SENSITIVITY_LIGHT
public static final int SENSITIVITY_MEDIUM
public static final int SENSITIVITY_HARD
public ShakeDetector(ShakeDetector.Listener listener)
public boolean start(android.hardware.SensorManager sensorManager)
public void stop()
public void onSensorChanged(android.hardware.SensorEvent event)
onSensorChanged in interface android.hardware.SensorEventListenerpublic void setSensitivity(int accelerationThreshold)
public void onAccuracyChanged(android.hardware.Sensor sensor,
int accuracy)
onAccuracyChanged in interface android.hardware.SensorEventListenerCopyright © 2015 Square, Inc.. All Rights Reserved.