Mobile Development 10 min read

How to Measure and Reduce Mobile App Power Consumption: A Practical Guide to Battery Testing

This article explains what power testing is, why it matters for mobile apps, and provides step‑by‑step hardware and software methods—including custom measurement devices, Android battery stats, and adb commands—to evaluate and optimize an app's energy usage.

Tencent TDS Service
Tencent TDS Service
Tencent TDS Service
How to Measure and Reduce Mobile App Power Consumption: A Practical Guide to Battery Testing

Evaluating whether a mobile application consumes excessive power and how to test it is the focus of this article, introducing the emerging testing type called power testing.

Battery technology has lagged behind the rapid growth of smartphone features, leading to short standby times that users frequently criticize. While modern phones typically have 3000 mAh batteries, their actual standby duration is often less than a third of that of older feature phones.

1 What Is Power Testing

Power testing measures the speed of battery consumption on mobile devices, usually by monitoring average current (mAh). Lower average current indicates longer usage time. There is no universal standard; the Tencent Smart Platform Testing team defines scenario‑specific reference values, such as an average current below 10 mA for idle standby without network.

On Android, the difference between standby and active average current can span an order of magnitude. Improper API usage that prevents the CPU from sleeping can cause significant power drain, which power testing aims to detect and resolve.

2 Methods for Power Testing

There are two main approaches: hardware testing and software testing.

Hardware testing uses external instruments to measure the device’s current over time. Typical equipment includes a regulated power supply, a current meter, and a PC. The article’s team built a low‑cost device called “Power Meter” (电量宝) to capture real‑time current and voltage data.

The Power Meter’s hardware modules are:

Power source: either the device’s original battery (cheaper, more realistic) or a regulated supply (more stable).

Power Meter chip: powered by 5 V USB, communicates via serial port.

Test device: battery removed, connected to the meter’s leads.

Key considerations during hardware testing include ensuring the battery is fully charged, using appropriate voltage (typically 4.0–4.5 V), selecting low‑resistance copper wires, and correctly matching polarity to avoid damage.

After setup, the meter records raw current data, from which the average current can be calculated. An example shows a real‑time current curve for a Samsung GT‑I9500 during boot, with an average of 480 mA.

Software testing leverages Android’s built‑in battery usage statistics (available from Android 4.1) or third‑party tools such as Battery Doctor. These tools can break down power consumption by app process, showing CPU time, wakelock duration, network data, GPS usage, etc. Some metrics require source code modifications to expose.

Power data can also be retrieved via ADB: adb shell dumpsys batterystats/batteryinfo On Android 4.4+ the service is batterystats; earlier versions use batteryinfo. The command returns overall system consumption and per‑process details, illustrated by the following screenshots.

To perform power testing, define the target scenario, measure the device’s average current with hardware tools, analyze whether it exceeds the reference value, then use software profiling to pinpoint high‑consumption components (CPU, Wi‑Fi, cellular, GPS, Bluetooth). Optimize the code, repeat the measurement, and continue until the average current meets expectations. The next article will dive deeper into hardware and software testing details and practical case studies.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

mobile testingpower testingbattery consumptionhardware measurementsoftware profiling
Tencent TDS Service
Written by

Tencent TDS Service

TDS Service offers client and web front‑end developers and operators an intelligent low‑code platform, cross‑platform development framework, universal release platform, runtime container engine, monitoring and analysis platform, and a security‑privacy compliance suite.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.