Android: How to increase Accelerometer Sampling Rate?
-
26-09-2019 - |
문제
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
해결책
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.
다른 팁
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.
Yse the microphone. If you vibrate the phone in 50 Hz the mic will get it.