3

I wanted to calculate the remaining hours of battery and subsystem as talk time, websurfing, audio playback, video playback and standby.

I used reflection to get private class com.android.internal.os.PowerProfile and android.os.BatteryStats.

I followed Android's battery setting http://netmite.com/android/mydroid/donut/packages/apps/Settings/src/com/android/settings/fuelgauge/PowerUsageSummary.java

to get remaining hours of battery

with method:

long computeBatteryRealtime(long curTime, int which);

with:

curTime = SystemClock.elapsedRealtime() * 1000;
which = STATS_UNPLUGGED

But the return value was wrong, a few minutes. Do I use this method right ?

Himanshu
  • 4,327
  • 16
  • 31
  • 39
Sa Vo
  • 41
  • 3

0 Answers0