Mobile Development 7 min read

Testing Power Consumption of Push SDK on Mobile Devices

This article explains how to prepare, execute, and analyze power and network traffic consumption tests for push SDKs on mobile devices, covering SDK separation, key power‑draining operations, methods to retrieve traffic data via PID and UID, common issues, and practical solutions.

360 Tech Engineering
360 Tech Engineering
360 Tech Engineering
Testing Power Consumption of Push SDK on Mobile Devices

Recently a product team reported excessive power and data usage when using our push SDK, prompting an investigation into the causes. This guide outlines the preparation, testing process, and result analysis for measuring SDK power consumption.

A、B、C、D排除法

Since the push SDK includes our own SDK (A) and third‑party SDKs (B, C, D), the test must isolate each SDK to identify the main power‑draining culprit.

哪些操作会产生功耗

The demo generates power consumption through three main actions: (1) periodic heartbeat between the SDK and push server, (2) real‑time data upload to qdas after data generation, and (3) push server delivering messages to the SDK.

如何获取SDK所产生的功耗

To measure traffic consumption, the steps are:

1. Obtain the application’s process ID (procID). 2. Retrieve the UID from the process ID. 3. Use the UID to query the device for upstream (tcp_snd) and downstream (tcp_rcv) traffic.

Images illustrate the commands and results for each step.

脚本实现

The provided script extracts upstream and downstream traffic by passing the UID to a method that reads the corresponding files.

测试重点:

1. Traffic consumption during periodic heartbeat. 2. Traffic changes when push messages are received. 3. Total traffic (upstream + downstream) comparison across different SDKs. 4. Convert byte values to KB or MB.

测试时遇到的问题:

1. Some devices restrict access to UID and traffic directories, requiring alternative phones for testing. 2. Heartbeat traffic is minimal (a few bytes) and can be easily overlooked. 3. Unexpectedly higher upstream traffic during push messages due to real‑time reporting to qdas. 4. After killing the process or reinstalling the app, traffic may include historical data stored under the previous UID.

Solutions include rebooting the device before reinstalling or programmatically subtracting historical data.

小灶时间

Question: When a chat app receives a message while in the background, which component is responsible for displaying the top‑screen notification on iOS and Android?

Answer: iOS uses APNS; Android uses the app’s client invoking system APIs.

The article concludes with a call for readers to share their thoughts on push SDK testing.

AndroidMobile testingPower Consumptionnetwork trafficpush SDK
360 Tech Engineering
Written by

360 Tech Engineering

Official tech channel of 360, building the most professional technology aggregation platform for the brand.

0 followers
Reader feedback

How this landed with the community

login 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.