I'm making a face recog app and I want to do a little benchMarking in it. Want some help in measuring the battery. I was trying something like this:
public float calcBattery(float init){
float batteryValue;
int level = batteryStatus.getIntExtra(BatteryManager.EXTRA_LEVEL, -1);
int scale = batteryStatus.getIntExtra(BatteryManager.EXTRA_SCALE, -1);
batteryValue = (init - (level / (float)10000));
if (batteryValue<0) batteryValue*=-1;
return batteryValue;
}
but since my application runs in 2 to 17 seconds depending on the number of faces the batter level always appear to be unchanged. I want to know if there is a proper way to do battery benchmarking on android without a third party.
Thanks in advance
Edit:
I wanted to have some way of measuring battery more precise then the level of the battery, like mA for instance. And I don't have a clue as how to measure in mA, but I know is possible since there are apps that do it like that.