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

Comments

Popular posts from this blog

Clear the app data programmatically in android

convert an integer to a string in java

Print the large string values in android log cat.