If you don't care about the specifics (e.g. Precisely speaking there's no such thing as single "CPU temperature" value, there are many. One might guess by the name of the sensor if it related to CPU or not (containing CPU or SoC or smth else in the name). There're multiple files with different sensor names at a single device. under /sys/devices/virtual/thermal/thermal_zone0 one might read "cpu-0-0-user" value from type file and "32100" value from temp file. ![]() Programs such as CPU-Z have internal list of paths which can be probed for files that contain the name of the sensor/reading (typically named "type" or "name") and actual value (typically named "temp"). The only way to get CPU temperature is having a comprehensive list of "magic" paths with system files reporting temperature readings.HardwarePropertiesManager API is only viable for Android Enterprise, not a typical use-case.There's no CPU temperature available through standard Sensor API.Samsung Galaxy S8+ SM-G955N (Exynos) API 26.Samsung Galaxy S9+ SM-G965F (Exynos) API 28.Samsung Galaxy S10 SM-G973F (Exynos), API Level 28.Xiaomi Mi 8SE API 27 (found one of CPU core's temp at /sys/devices/virtual/thermal/thermal_zone9/temp).Samsung Galaxy Note 10 (Snapdragon) API 29. ![]() Xamarin.Android sample is here - it's as straight forward as looping through a list of predefined file paths (23 in my case) and reading a line from the first file which do not fail upon opening (and then converting the string to a number, scaling it to degrees).
0 Comments
Leave a Reply. |