title: How do I get the CPU temperature?
body: <p>I know it's somehow possible to get the CPU's temperature because I downloaded an app that does it in an unrooted device. How is it done?</p>
  
  <p>edit: The application is called A1 CPU Tool. I spent several days searching for an answer.</p>
  
  <p>edit2: Here's the code I tried</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
      Sensor TempSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE);
      mSensorManager.registerListener(temperatureSensor, TempSensor, SensorManager.SENSOR_DELAY_FASTEST);
  }
  
  private SensorEventListener temperatureSensor = new SensorEventListener(){
  
      @Override
      public void onAccuracyChanged(Sensor sensor, int accuracy) {
          // TODO Auto-generated method stub
  
      }
  
      @Override
      public void onSensorChanged(SensorEvent event) {
          // TODO Auto-generated method stub
          float temp = event.values[0];
          Log.i("sensor", "sensor temp = " + temp);
      }
  };
  </code></pre>