Skip to main content

Network · SetOffline · ShapeNetwork · SetProxy · ResetNetwork

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Read or set the device's network conditions: offline, latency, bandwidth and an HTTP proxy. These call app_network.

Network​

public IDictionary<string, object?> Network()

The network: airplane, online, and the shaping — latency_ms, download_kbps, upload_kbps, zero for none. Android only.

SetOffline​

public IDictionary<string, object?> SetOffline(bool offline = true)

Turns airplane mode on or off and waits for the network to follow — on an emulator or a real Android phone.

ShapeNetwork​

public IDictionary<string, object?> ShapeNetwork(int latencyMs = 0, int downloadKbps = 0, int uploadKbps = 0)

Adds latency to each round trip and limits download and upload, in kbit/s, replacing any shaping set before; zero is none. Needs root, so an emulator.

SetProxy​

public IDictionary<string, object?> SetProxy(string hostport)

Points the device's HTTP proxy at host:port — 127.0.0.1 is this machine's, through adb reverse — or takes it off with an empty string. Any Android device.

ResetNetwork​

public IDictionary<string, object?> ResetNetwork()

Removes the shaping and the proxy and turns airplane mode off.

Examples​

Go offline​

device.SetOffline();

The same call from the command line, mobium network --offline, printed on an Android 15 emulator:

offline (airplane mode)
BeforeAfter
Before: mobium network --offline on an Android 15 emulatorAfter: mobium network --offline on an Android 15 emulator

mobium network --offline on an Android 15 emulator

A slow connection, on an emulator​

device.ShapeNetwork(latencyMs: 300, downloadKbps: 500);

The same call from the command line, mobium network --latency 300 --download 500, printed on an Android 15 emulator:

online; 300ms added to each round trip, download 500 kbit/s