Full Stack developer in Egypt. I build apps and the servers behind them.
Metering, packages and billing, in use on my own network.
A system that meters Wi-Fi data on each subscriber's phone and bills by the GB. Every number on every screen is money, so none of them can be "close enough". I built the whole chain: the app on each phone, a second app that is my admin tool and controls the routers, a desktop client, and the server between them.
The phone counts, the server asks. Each device reads Android's own per-app network records and keeps its own ledger. The server does not poll continuously. It pulls a reading when the admin presses refresh, and on a 30-minute schedule as a safety net. That keeps a free server tier from being the bottleneck, and it means the figure on the user's screen is the figure the bill is built on.
| User app | Android, Kotlin. Counts usage per network, shows remaining quota, takes top-ups with a receipt, renews packages, pairs to the admin with a QR code.minSdk 26, target 33 |
|---|---|
| Guard app | Android, Kotlin. The admin tool I use day to day. Every subscriber with quota, used and remaining, per-device readings and health, top-up requests to approve or reject, payments and voids, renewals, per-network packages, alerts. It also adds and removes devices on two router models.router login stored encrypted on the device |
| Desktop client | Windows, written in Go, serves its own local page. One person's own usage, settings and disconnect. |
| Server | Cloudflare Worker in JavaScript with a D1 database, a 30-minute cron and 18 SQL migrations. It also serves a browser admin page with users, history by date, payments, top-up requests and alerts, as a fallback to the guard app. |


Android keeps its usage records in roughly one-hour buckets, so figures are accurate to about an hour at the edges. A phone's owner can always stop the app or revoke its permissions. The numbers are the phone's estimate, not a router-side measurement.
Over 450 unit tests across the two apps cover the counter, renewals, debt, offline behaviour and the permission flow.
© 2026 Hazem Aboelnaga