Pergunta

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.

Foi útil?

Solução

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

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top