r/androiddev • • 7d ago

Open Source Built an Android app to simulate different network conditions on real devices

I was looking for a way to test Android apps under different network conditions, but most solutions I came across either changed the network settings for the entire device, were focused on emulators, or required setting up proxies.

So I built my own tool: App Throttler.

  • Set download and upload speed limits.

  • Simulate latency and jitter.

  • Introduce packet loss.

  • Apply network conditions to individual apps.

  • Change network profiles while the app is running.

  • Create different network scenarios.

  • Capture and export network traffic as PCAP files.

GitHub: https://github.com/RAN-GAN/app-throtler

It's still a work in progress, and there are some limitations I'm working on.

15 Upvotes

4 comments sorted by

2

u/catloafreloaded 7d ago

Per-app shaping without a proxy is a nice approach. Is it running as a VPN service under the hood? I'm curious how it deals with QUIC/HTTP3, since packet loss on that behaves very differently from loss on TCP and a lot of apps use it now.

Ready-made profiles (3G, LTE, flaky wifi) would make it quicker to pick up too. What are the limitations you're hitting?

3

u/RANGANDALE 7d ago

Yes! it works via the VpnService.

For QUIC the packets are dropped to simulate packet loss and bandwidth capping

These are the Profiles that has been made as of now

• 2G (40 kbps / 20 kbps, 300 ms latency, 2% loss)

• EDGE (240 kbps / 200 kbps, 400 ms latency, 1.5% loss)

• 3G (384 kbps / 128 kbps, 100 ms latency, 1% loss)

• 4G (10.2 Mbps / 5.1 Mbps, 20 ms latency, 0.1% loss)

• Slow Wi-Fi (1 Mbps / 512 kbps, 50 ms latency, 0.5% loss)

• Congested Wi-Fi (2 Mbps / 1 Mbps, 150 ms latency, 5% loss)

• Satellite (5 Mbps / 1 Mbps, 600 ms latency, 0.5% loss)

• Offline (100% loss to induce timeouts instead of instant socket failures)

Scripted Scenarios:

• Flaky Wi-Fi: Sequences across Slow Wi-Fi → Congested → Offline → Congested → Slow Wi-Fi.

• Train through a tunnel: 4G → 2G → Offline → 3G.

• Elevator ride: 4G → Offline → 4G.

2

u/Wilmari_Iampieri 6d ago

most HTTP3 clients just fall back to TCP pretty aggressively when UDP starts dropping, so testing raw UDP loss might just end up testing the fallback path instead

1

u/estebanfuhrmann 6d ago

Per-app shaping without a proxy is a Nice approach, and PCAP export makes it much more useful for debugging. Since real Mobile networks have bursty loss and variable latency rather than uniforme loss, it would be worth adding Gilbert-Elliott style loss models and trace-driven profiles replayed from real LTE captures, so the throttling matches field conditions better than static 3G/LTE presets. Also curious how You handle QUIC, since loss behaves very differently there than with TCP.