Question

I'm new to android and working on an app that will aggregate sensor data and display it on screen. When I only retrieved accelerometer data, the output was smooth. Now, when I try retrieving gyroscope and lux data as well, the output speed is slower and inconsistent.

Is there a more efficient way of doing this?

// code omitted

EDIT: I've started looking into implementing the retrieval of sensor data as an AsyncTask. But I run into the issue that the OnSensorChanged method would still be part of the UI thread. Is there a way I can avoid this? Is asynctask the way to go?

Was it helpful?

Solution

I seem to have found a solution (for now at least):

Setting the delay for the listeners to SENSOR_DELAY_UI from SENSOR_DELAY_FASTEST has made the output smooth (I know, right?). My guess is that this is due to delays on the thread at such a high polling rate.

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