Using Seismic shake detection

suggest change

Seismic is an Android device shake detection library by Square. To use it just start listening to the shake events emitted by it.

protected void onCreate(Bundle savedInstanceState) {
    sm = (SensorManager) getSystemService(SENSOR_SERVICE);
    sd = new ShakeDetector(() -> { /* react to detected shake */ });

protected void onResume() {

protected void onPause() {

To define the a different acceleration threshold use sd.setSensitivity(sensitivity) with a sensitivity of SENSITIVITY_LIGHT, SENSITIVITY_MEDIUM, SENSITIVITY_HARD or any other reasonable integer value. The given default values range from 11 to 15.


compile 'com.squareup:seismic:1.0.2'

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents