How to get CPU temperature in Android

瘦欲@ 提交于 2019-11-29 01:49:13

I've used the following path:

sys/class/hwmon/hwmonX/temp1_input

that works on the most phones

Deprecated does not equal removed! If you find that the device still offers the deprecated sensor type, then go ahead and continue to use it.

Part of the reason for deprecating the old sensor name was that on seeing a temperature sensor, the public expectation was that the temperature would be that of the ambient air. However in many cases the sensor was part of/so close to the CPU that it ended up being mostly a reflection of the CPU temperature.

By adding a new (optional) sensor type that is explicitly the air temperature, this expectation can be better managed:

  • if you want the air temperature, use the new sensor if available
  • if you don't care what you are measuring (but in most practical cases will end up with something heavily influenced by the CPU temperature), use the deprecated sensor if available
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!