2
intent.getIntExtra(BatteryManager.EXTRA_TEMPERATURE, 0);

I have this code, returning: 285, 292, 300 etc

What is this magic number? How can it be convert to Celsius?

Ahmad
  • 69,608
  • 17
  • 111
  • 137
lacas
  • 13,928
  • 30
  • 109
  • 183

3 Answers3

7

voltage- int, current battery voltage in millivolts

temperature - int, current battery temperature in tenths of a degree Centigrade

Here is the source file

Community
  • 1
  • 1
DjHacktorReborn
  • 2,908
  • 2
  • 20
  • 29
4

You have to divide that by 10, meaning 285 would be 28.5 °C, 292 -> 29.2 °C and 300 -> 30.0 °C

Ahmad
  • 69,608
  • 17
  • 111
  • 137
1

The values are 28.5 , 29.2 and 30.0 degree Celsius

value = value/10

Android Battery in SDK

Community
  • 1
  • 1
Srinath Ganesh
  • 2,496
  • 2
  • 30
  • 60