Shake Detection Library
If you want to detect the shake sensor,
Implement like this, SensorManager
public class Demo extends Activity implements ShakeDetector.Listener
Class Implementation,
SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
ShakeDetector sd = new ShakeDetector(this);
sd.start(sensorManager);
Interface
public void hearShake() {
Toast.makeText(this, "Now You're Shaking", Toast.LENGTH_SHORT).show();
}
Get the Library from this link
Implement like this, SensorManager
public class Demo extends Activity implements ShakeDetector.Listener
Class Implementation,
SensorManager sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
ShakeDetector sd = new ShakeDetector(this);
sd.start(sensorManager);
Interface
public void hearShake() {
Toast.makeText(this, "Now You're Shaking", Toast.LENGTH_SHORT).show();
}
Get the Library from this link
Comments