How to calculate power consumption of android app?

后端 未结 2 1610
鱼传尺愫
鱼传尺愫 2021-02-09 19:53

Whether there is any formula ,Api or method for it? I want to test the power consumption of different apps.

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-09 20:13

    In order to analyse the power consumption, e.g. to estimate the mAh usage, checkout:

    To see what's happening live (wakelocks, cpu, sensors, etc.):

    • [API 26+] the Energy Profiler* - modern UI included in Android Studio

    To see what happened over time, e.g. this day:

    • [API 21+] the Battery Historian - in combination with Dumpsys Battery. See their github project for instruction. Hovering the battery level chart (black in the screenshot) gives you the discharge rate in mAh when your phone was not charging.

    I haven't found out yet if it's possible to see an estimated mAh consumption instead ob abstract "low, mid, high" units in the Profiler. Comment please if you do so. The Historian should be able to do so based on the documentation.

提交回复
热议问题