Skip to main content

network · set_offline · shape_network · reset_network

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

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

network​

def network() -> dict

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

set_offline​

def set_offline(offline: bool=True) -> dict

Turn airplane mode on (or off) and wait for the network to go (or come back) — on an emulator or a real Android phone.

shape_network​

def shape_network(latency_ms: int=0, download_kbps: int=0, upload_kbps: int=0) -> dict

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

reset_network​

def reset_network() -> dict

Remove the shaping and turn airplane mode off.

Examples​

Go offline​

device.set_offline()

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.shape_network(latency_ms=300, download_kbps=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