문제

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?

도움이 되었습니까?

해결책

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

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top