0

I am working on android application which needs the function to alert the user, when the device is reaching its maximum CPU temperature.

Is there any existing broadcast receiver to detect the CPU Temperature ?? or Whats the best way to achieve this ??

Note: Know that the CPU temperature can be pulled from sys/class/thermal/thermal_zone0/temp, but looking for a solution to receive through the broadcast.

Karthikeyan
  • 199
  • 1
  • 3
  • 9
  • May be [this](https://stackoverflow.com/a/11931903/4168607) will help. – ADM Oct 31 '17 at 09:51
  • 2
    Possible duplicate of [How to get CPU temperature in Android](https://stackoverflow.com/questions/24797869/how-to-get-cpu-temperature-in-android) – Nilesh Deokar Oct 31 '17 at 09:51
  • @NileshDeokar : The solution you referred, need to pull data every time. But my case is the application needs to be alerted even when it runs backgrond. – Karthikeyan Oct 31 '17 at 10:07
  • @ADM : TYPE_AMBIENT_TEMPERATURE will provide us room temperature, but not the CPU temperature – Karthikeyan Oct 31 '17 at 10:09
  • You might have to create a `Service` and add `SensorEventListener` to it. and from there if it reaches the threshold level you can use `LocalBroadcastManager` to update app state – Nilesh Deokar Oct 31 '17 at 10:13
  • @NileshDeokar : If I am not wrong, the Temperature Sensor in Android will provide us room temperature, but not the CPU temperature right ?? – Karthikeyan Oct 31 '17 at 10:20
  • Have a look at this. https://stackoverflow.com/a/11931903/3746306 – Nilesh Deokar Oct 31 '17 at 10:28
  • Thanks @ADM and NileshDeokar : Just noticed that the sensor TYPE_TEMPERATURE which used to detect Device temperature is depricated , and suggested to use TYPE_AMBIENT_TEMPERATURE. – Karthikeyan Oct 31 '17 at 10:47

0 Answers0