Search code examples
androidshakevibrationandroid-vibration

android - shake detection


I use this good library for detect shake motion on android devices. Everything is good! But on my phone (Sony Xperia P) receiving SMS cause my phone to vibrate and shake detected!
In some other phone like HTC Sensation XE, the problem doesn't exist.
Any suggestion?
Thanks is advance.


Solution

  • Replacing SensorManager.SENSOR_ACCELEROMETER with Sensor.TYPE_ACCELEROMETER in sensorMgr.getDefaultSensor solved my problem!
    The SensorManager.SENSOR_ACCELEROMETER has been deprecated in API level 3 (Link).