简体   繁体   English

android - 震动检测

[英]android - shake detection

I use this good library for detect shake motion on android devices. 我使用这个好的库来检测Android设备上的抖动。 Everything is good! 万事皆安! But on my phone (Sony Xperia P) receiving SMS cause my phone to vibrate and shake detected! 但在我的手机(索尼Xperia P)接收短信导致我的手机振动和震动检测到!
In some other phone like HTC Sensation XE, the problem doesn't exist. 在像HTC Sensation XE这样的其他手机中,问题不存在。
Any suggestion? 有什么建议吗?
Thanks is advance. 谢谢你的提前。

Replacing SensorManager.SENSOR_ACCELEROMETER with Sensor.TYPE_ACCELEROMETER in sensorMgr.getDefaultSensor solved my problem! Sensor.TYPE_ACCELEROMETER中的sensorMgr.getDefaultSensor替换SensorManager.SENSOR_ACCELEROMETER解决了我的问题!
The SensorManager.SENSOR_ACCELEROMETER has been deprecated in API level 3 ( Link ). SensorManager.SENSOR_ACCELEROMETER已在API级别3( 链接 )中弃用。

This issue may be caused by the difference of sensor sensitivity across mobile devices. 此问题可能是由于移动设备之间传感器灵敏度的差异造成的。 Your Xperia has presumably more sensitive sensor than the HTC. 您的Xperia可能比HTC更灵敏。 You can check this by setting your detection to be less agressive. 您可以通过将检测设置为不那么激进来检查这一点。

Doubling MINIMUM_EACH_DIRECTION in ShakeDetectActivity class should do the job. ShakeDetectActivity类中加倍MINIMUM_EACH_DIRECTION应该可以完成这项工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM