Android: How to increase Accelerometer Sampling Rate?

家住魔仙堡 提交于 2019-12-25 16:53:53

问题


I am currently using Java API to get accelerometer values in 5Hz, which is below my requirements. I want to achieve at least 50Hz. Is there any way to increase the sampling rate of accelerometer?

Regards


回答1:


I think the maximun sampling rate is diferent between diferent android phones. What i think you can do is setup the sensormanager to update the data as fast as it can, take a look of the constant SENSOR_DELAY_FASTEST from the documentation.

regards.




回答2:


The param SENSOR_DELAY_FASTEST indicates to android to poll for data as fast as it can.

The sampling-rate of the accelerometer is determined by the driver is different from the polling rate which is configurable in Android.

There are no APIs for the java/C apps to control the internal sampling-rate. This is because the kernel-drivers do NOT expose any APIs to control the h/w sampling-rate as it is best left to the designers of the device to set this.

You can poll for the accel-data as often as you need it. Check in the source (if you have access) or with the ODM/OEM for details of the accelerometer's internal sampling rate.




回答3:


Yse the microphone. If you vibrate the phone in 50 Hz the mic will get it.



来源:https://stackoverflow.com/questions/4224223/android-how-to-increase-accelerometer-sampling-rate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!