2

I would like to know if Android and/or IOS have some API or whatever to measure the energy thay the phone/tab is currently using (depleting) or have been using for X secondes/minutes....

Something like : you phone has used 200wh in the last X minutes... Or you phone is currently using 3wh...?

Many thanks Gerald

1 Answers1

1

You can use Battery Historian on Android to monitor battery consumption for a single app if this is for development purposes. https://developer.android.com/studio/profile/battery-historian.html

You can run the ADB commands battery historian runs on the device using ProcessBuilder https://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html see Is it possible to execute adb commands through my android app? for more info

https://developer.android.com/training/monitoring-device-state/battery-monitoring.html that is article on how to read battery information on Android.

For iOS there is https://developer.apple.com/library/content/documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/MeasuringEnergyImpact.html for measuring energy use during development.

Not sure about reading battery state while running on iOS

Community
  • 1
  • 1
JLamkin
  • 721
  • 6
  • 17
  • this is really usefull and I might use this later! – user7015374 Oct 14 '16 at 19:53
  • nevertheless this is not quite exactly what I am looking at : what I am looking is how much energy my phone is using in Wh, and even if the battery is fully charged and plugged on current. But maybe your solution is the way to do this and I didn"t get it ? – user7015374 Oct 14 '16 at 19:54
  • Updated answer to point you towards how to run battery commands on the app. – JLamkin Oct 14 '16 at 20:06
  • thank you.But again : this doesn't answer my question. Before diving into specifics you gave me, can you explain me the way to do it simply ? – user7015374 Oct 14 '16 at 21:06