Android Battery & Power Usage
The Battery & Power Usage metric measures the battery consumed by the app during the session. It also shows the percentage of total battery consumed by the app during the session. The percentage of total battery consumed by the app in a session is calculated using the following formula:
(Total battery consumed by the app in a session * 100) / Total battery capacity of the device
In the app performance report, go to the Battery & Power Usage section to view the battery consumed by the app in a session. In the graph, the axes represent the following:
- X-axis: Depicts the time (in seconds) elapsed since the start of the session. 0 on the X-axis represents the start of the profiling session.
- Y-axis: Depicts the total energy value (battery consumed) in mAh by the app till a particular time since the start of the session. The Y-axis starts with 0 mAh.
Example
In the following example, the total battery consumed is 0.051% of the total battery capacity of the Google Pixel 6 Pro (5003 mAh). The points on the graph show the cumulative battery consumption by the app till a particular time since the start of the session. For example, in the following graph, the app consumed 1.03 mAh battery till 34.49 seconds of the session since the session started.
Understanding battery metrics across sessions
When testing multiple sessions on the same device model, it’s important to consider that while the device model, OS version (for example, Samsung Galaxy S22 with Android 13), and test scripts may remain consistent, the actual device allocated by BrowserStack in the cloud for each session may vary.
Battery capacity reduces over time with regular use. This means that even if two devices are the same model, their battery performance may differ due to aging.
For example, the Samsung Galaxy S22 (Android 13) is designed to have a 3700 mAh battery. But a well-used phone might hold less charge. This means that it could show higher mAh use in a session, even under the same test setup.
Device | Designed Capacity (mAh) | Effective Capacity (mAh) | Notes |
---|---|---|---|
Galaxy S22 (A) | 3700 | 3550 | Moderate wear |
Galaxy S22 (B) | 3700 | 3400 | Higher wear, reduced health |
Instead of comparing values like mAh consumed, focus on the trends or changes in battery usage over time—especially when using the same device for multiple sessions. This approach offers a more consistent and insightful basis for analysis.
Impact on user experience
Users abandon apps that use excessive battery. Android could also kill apps that use excessive battery. As per a Techbeacon survey, over a third of the app users (36%) stopped using a mobile app because of heavy battery usage.
Threshold guidelines
The recommended threshold is 0.5% or less percentage of battery consumed per minute.
If your app exceeds the threshold, App Performance Testing flags an issue in the performance report. To know more about the issue, see App performance issues - Battery Usage.
Recommendations
The following are the recommendations to improve the Battery Usage:
- Optimize app wake locks: Use wake locks judiciously and make sure to release them when they’re no longer needed.
-
Use JobScheduler: Use the
JobScheduler
API to schedule non-urgent work to happen when the device is already awake and connected to a power source. -
Use AlarmManager judiciously: Use the
AlarmManager
API only when it’s necessary, and be mindful of the time intervals at which you set the alarms. - Monitor network connectivity: Monitor network connectivity and adapt app behavior to avoid battery drain when the network is flaky.
- Use Battery Historian: Use Battery Historian to identify power-hungry code paths and optimize the app’s resource usage accordingly.
Related topics
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
We're sorry to hear that. Please share your feedback so we can do better
Contact our Support team for immediate help while we work on improving our docs.
We're continuously improving our docs. We'd love to know what you liked
Thank you for your valuable feedback!