1

I’m looking for battery parameter in Ruby that’s tells me the usage while the app is running.

I want to take the battery status snapshot in the beginning of the run, take another snapshot in the end of the run and then calculate the usage.

Battery level status won’t give me the result that I need – the app runs are shorts in my testing and the % won’t change or won’t give me what I need.

I abled to connect to the device wireless for those tests

(the command: adb shell setprop persist.usb.chgdisabled 1 didn’t work).

The command adb shell dumpsys battery won’t give me anything.

Maybe it is the command adb shell dumpsys batteryinfo

Your thoughts?

Nir Ortal
  • 77
  • 12

1 Answers1

2
adb shell dumpsys batterystats

Should give you the info you want.

alannichols
  • 1,496
  • 1
  • 10
  • 20
  • 1
    Be aware that `adb shell` commands are not allowed on Xamarin's Test Cloud. – jmoody May 01 '15 at 11:54
  • thank you for the quick responding - the message that i get 'Can't find service: batterystats' ---> i think this command works on android 5.0 and up – Nir Ortal May 03 '15 at 07:15
  • 3
    Ahh, sorry about that. Aparently it's 'adb shell dumpsys batteryinfo' before API 19. – alannichols May 03 '15 at 10:57