Question

I'm working in my thesis, and I need to explore the google Android API to find a way to get every possible information about the CPU and Battery (like CPU temperature, % of usage, battery level, energy consumption, ...).

The idea is measuring, in 2 or more different execution times, the energy consumed by an Android APP, and get details on what was used by the APP to spend that energy.

Does anyone know any API from Android to measure this kind of things?

Was it helpful?

Solution

For getting battery level, you can register an Intent for ACTION_BATTERY_CHANGED. For more information refer to the Android Battery API. If you just want to get the battery temperature, you can get it using the API itself. I think Android does not have an API for CPU temperature.

However, you can read the temperature from /sys/class/thermal/thermal_zone0/temp This is the way to get temperature on linux based systems and since Android is Unix based, I think you should be able to do it. I haven't tried it myself though

OTHER TIPS

Take a look at Monitoring the Battery Level and Charging State guide. Concerning CPU, you should be able to collect some data from Systrace.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top