Android network monitoring system

VAPNMeter

A network monitoring application designed to make connection quality visible without turning continuous observation into continuous battery cost.

Overview

How can Android observe network quality in real time while respecting platform restrictions, persistence needs, and battery limits?

Network speed alone is not enough to explain a poor connection. VAPNMeter brings live traffic, latency, packet loss, daily usage, and speed testing into one Android system.

Problem

The application must maintain useful live feedback while Android limits background work and every sample, wake-up, database write, and network request has an energy cost.

Constraints

  • Foreground-service and background-execution restrictions
  • Continuous updates without wasteful polling
  • Durable daily usage and monitoring history
  • Unreliable or changing network conditions
  • Actionable alerts without notification fatigue

Architecture

Observation to insight

Select a monitoring responsibility to trace its inputs and outputs. Speed tests are on demand; continuous observation has a different energy budget.

  • Android network counters and connectivity provide the platform signals.

  • A foreground service provides the lifecycle boundary for continuous monitoring.

  • Latency and packet loss describe connection quality beyond raw throughput.

  • TrafficStats supplies traffic counters for live usage and daily summaries.

  • M-Lab NDT measures throughput on demand, separate from continuous monitoring.

  • History and preferences have different persistence responsibilities. Exact write policies need source verification.

  • Monitoring information becomes readable feedback and actionable alerts; WorkManager supports deferred work.

Trace a relationship

Focus or hover a node to highlight its connections. Select to keep it highlighted; select again or press Escape to clear.

Conceptual architecture from the project brief. Arrows show information direction, not live traffic.

Read all responsibilities and connections
Android device
Android network counters and connectivity provide the platform signals.
Foreground monitor
A foreground service provides the lifecycle boundary for continuous monitoring.
Ping / loss
Latency and packet loss describe connection quality beyond raw throughput.
Traffic / usage
TrafficStats supplies traffic counters for live usage and daily summaries.
Speed test
M-Lab NDT measures throughput on demand, separate from continuous monitoring.
Room / DataStore
History and preferences have different persistence responsibilities. Exact write policies need source verification.
Insight / alerts
Monitoring information becomes readable feedback and actionable alerts; WorkManager supports deferred work.
  • Android device → Foreground monitor: network signals
  • Android device → Speed test: on-demand test
  • Foreground monitor → Ping / loss: quality sampling
  • Foreground monitor → Traffic / usage: traffic observation
  • Ping / loss → Room / DataStore: monitoring history
  • Traffic / usage → Room / DataStore: usage summaries
  • Room / DataStore → Insight / alerts: history and preferences
  • Speed test → Insight / alerts: test result

Engineering decisions

Design rationale from the project brief. Code-level examples and measured tradeoffs are pending verification.

Decision 01

Separate live observation from scheduled work

Foreground monitoring and deferred maintenance have different lifecycle and reliability requirements.

Decision 02

Persist summaries, not every transient signal

The data model should preserve useful history without amplifying write volume and battery consumption.

Decision 03

Treat alerts as product decisions

A technically correct alert is only useful when it is timely, understandable, and not repetitive.

Tradeoffs to validate

Comparison of the design directions in this brief, pending confirmation against the implementation.

Design direction
Separate continuous monitoring from deferred work
Alternative
Use one polling loop for every responsibility
Consequence
Lifecycle coordination becomes more explicit, but background maintenance does not need the same cadence as live observation.
Design direction
Persist useful summaries
Alternative
Store every transient sample
Consequence
Lower write volume sacrifices raw historical detail. Sampling and aggregation policies need measurement before this tradeoff can be quantified.

Implementation

Implementation scope based on the supplied project description.

Observe connection quality

Foreground-service monitoring combines live traffic, ping, and packet-loss information. TrafficStats supplies Android traffic counters; M-Lab NDT covers speed testing.

Keep useful history

Room supports monitoring history and daily usage, while DataStore handles application preferences. Sampling and write frequency are key battery tradeoffs.

Schedule and inform

WorkManager and smart alerts connect background work to useful feedback. Exact scheduling policies and alert thresholds still need implementation evidence.

Challenges and reliability

Reliability concerns that shape the engineering work:

  • Lifecycle-aware monitoring under Android process constraints
  • Failure-tolerant network checks and changing connectivity states
  • Battery-conscious sampling, persistence, and background scheduling

Outcome

VAPNMeter demonstrates end-to-end Android systems work: platform services, networking, local data, scheduling, observability, and product tradeoffs operating together.

Evidence to add

This case study describes engineering scope. Quantified outcomes and implementation claims need supporting material.

  • Annotated runtime or persistence code
  • Battery and resource measurements with device and test conditions
  • Verified alert thresholds and background recovery behavior

Technology

Kotlin
Primary Android language
Android
Lifecycle, services, platform APIs, and product delivery
Room / SQLite
Durable local data and queryable history
DataStore
Typed application preferences
REST API
Mobile-backend contracts and failure handling
Foreground Service
Lifecycle-aware continuous monitoring
WorkManager
Constraint-aware scheduled work
M-Lab NDT
Independent network speed testing