开发者

Voltage and Temperature readout - Order of Magnitude issue

开发者 https://www.devze.com 2023-03-28 04:22 出处:网络
I\'m reading out several values using the BatteryManager including voltage int volt = intent.getIntExtra(BatteryManager.EXTRA_VOLTAGE, -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 开发者_C百科order of magnitude or do I have to implement manual plausibility checks?

thanks


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

0

精彩评论

暂无评论...
验证码 换一张
取 消