1

I'm reading out several values using the BatteryManager including voltage

int volt = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -1);

The problem is, that some devices return mV and others V (e.g. 5122 and 5).

Question: Is there a way to retrieve the order of magnitude or do I have to implement manual plausibility checks?

thanks

StarsSky
  • 6,721
  • 6
  • 38
  • 63
DonGru
  • 13,532
  • 8
  • 45
  • 55
  • I also faced same problem and got no solution.Finally had to use if else test.Surely if it is 1 to 10 then volt otherwise converted it to volt by dividing 1000 – Rasel Aug 12 '11 at 10:39
  • I did the same as Rasel. It is stupid solution as you lose precision but better than nothing. – Tomáš Hubálek Mar 27 '14 at 08:58

1 Answers1

1

IMHO such a "scale" indicator only exists for the battery level (see http://developer.android.com/reference/android/os/BatteryManager.html) not for the voltage. Usually mV should be returned - but to be on the safe side you will need to do a plausibility check

DonGru
  • 13,532
  • 8
  • 45
  • 55