Question

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.

Was it helpful?

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).

OTHER TIPS

This issue may be caused by the difference of sensor sensitivity across mobile devices. Your Xperia has presumably more sensitive sensor than the HTC. You can check this by setting your detection to be less agressive.

Doubling MINIMUM_EACH_DIRECTION in ShakeDetectActivity class should do the job.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top