Android accelerometer, sensor usage and power consumption

倾然丶 夕夏残阳落幕 提交于 2019-12-21 04:27:12

问题


I have a quick question about the accelerometer in Android devices. Is it always on/active? Given that accelerometer is used to detect the orientation of the device, either landscape or portrait.

In the official documentation (SensorManager) it states that sensors should be turned off to save power. But I wonder if this only applies to others sensors like magnetic field sensors, gyroscope, light sensor and so on.

I need to make a case for power conservation and I don't want to make the mistake of saying that the accelerometer can at times be disabled, and instead use it for the purpose of disabling other sensors (in compass features of the application).

Or is the battery consumption by an accelerometer only related to an app being registered for receiving the data, while simply being "on" or enabled is not relevant since it always is?

Thanks for any clarification!


回答1:


Or is the battery consumption by an accelerometer only related to an app being registered for receiving the data, while simply being "on" or enabled is not relevant since it always is?

That's correct.

The power consumption results from your app running and registered for sensor events. This keeps your app running all the time, keeps it consuming CPU, and potentially can keep the device from sleeping.

As far as I know, there's no way to shut down the sensors. Now, that is not to say that the device does not smartly shut down the sensors if there's nothing listening to them. I don't know that, but it seems likely. Regardless, again, the trigger is listening to them, so I don't think it makes a difference for your question.



来源:https://stackoverflow.com/questions/9863131/android-accelerometer-sensor-usage-and-power-consumption

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