user7015374
user7015374

Reputation: 21

IOS or Android : is there a way to know energy usage in Wh?

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

Upvotes: 2

Views: 682

Answers (1)

JLamkin
JLamkin

Reputation: 721

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

Upvotes: 1

Related Questions