← All posts

Scripting cloud Android phones with ADB: a practical guide

Sep 11, 2026 · By Xavier Fok

Why interactive ADB stops working

Interactive ADB is fine until you’re running more than about five devices. Past that point, you’re either writing scripts or you’re drowning in terminal tabs, typing the same install or shell command over and over. The fix is ADB plus Python plus a fleet API, which gets you to fifty phones running install scripts in parallel, screenshots collected across the whole fleet, and orchestration that’s ready to drop into CI.

Cloud phones change the math here because every device is reachable over TCP. There’s no USB cable, no dongle, no flaky hub sitting between your script and the phone. That single fact is what makes fleet-scale scripting practical instead of painful.

This guide covers three things: listing your fleet through the API and connecting ADB to all of it, running parallel commands and collecting screenshots, and locking and unlocking devices for CI along with scheduled fleet maintenance.

The ADB-over-network primitive

On cloudf.one, adb is not open to the public internet. It runs through a WireGuard tunnel scoped to your own phone, switched on by invitation (the developer page has the details and how to ask). Once it is on, your phone answers on an ordinary host and port, and the standard ADB CLI accepts that as a serial, the same way it would accept a USB device ID. Every script in this guide is built on that one primitive: connect, run a command, disconnect.

Step 1: list your fleet via the API

Before you can script anything, you need to know what you have. cloudf.one exposes a REST API for device listing. Authenticate with a token, then query the fleet. You can filter by tag, for example a ci-pool tag, or by status, for example available, so you’re only working with the devices that are actually relevant to the task at hand.

Step 2: connect to many devices

Once you have the list, connect ADB to every device in it. Loop over the endpoints and issue a connect for each. Every reachable device shows up in your ADB device list, ready for commands.

Step 3: run the same command on every device

With the fleet connected, you can fan the same shell command out to every device in parallel. Cap concurrency at around twenty simultaneous ADB sessions so you’re not hammering a single command against fifty devices at once.

Step 4: install an APK across the fleet

The same fan-out pattern works for installs. Rolling an APK across many devices at once is useful for pushing new builds to a CI pool, refreshing a test app, or seeding a set of accounts for a multi-account workflow.

Step 5: collect screenshots from the fleet

Debugging why account forty seven is behaving differently from account forty six usually starts with a screenshot. Pull screenshots from every device in the fleet and open them side by side so you can visually scan for state that doesn’t match.

Step 6: orchestrate a workflow

Real work is rarely a single command. A typical workflow installs an app, launches it, waits, takes a screenshot, then uninstalls. Chained together, that sequence works as a usable smoke test across the whole fleet.

Step 7: handle failures and retries

ADB over a network connection drops sometimes. Wrap your commands with a retry that reconnects before trying again. At the scale of a hundred devices, seeing one to two percent transient failures on any given command is normal, and a retry-with-reconnect handles most of them without any manual intervention.

Step 8: lock and unlock for CI

For CI use, lock devices before a job starts and unlock them when it finishes. The API exposes lock and unlock calls directly, and wrapping those in a GitHub Actions step turns fleet reservation into a single line in your workflow file.

Step 9: scheduled fleet maintenance

Beyond individual jobs, a daily script can keep the fleet itself healthy: reboot phones that have been up too long, clear caches, and report back on device health. Run it from cron at three in the morning and the fleet maintains itself without anyone watching it.

Common pitfalls

Three issues catch most teams the first time they script ADB at scale.

The first is ADB server contention. One ADB server process talks to every device, and firing fifty parallel commands at once can overflow its internal queue. Capping concurrency at twenty to thirty commands avoids this.

The second is network flakiness. Cloud phone ADB endpoints drop occasionally, which is normal for anything running over a network rather than a physical cable. Always wrap commands in a reconnect-on-failure handler rather than assuming every call will succeed.

The third is command timeouts. Set a timeout on every subprocess call you make. Without one, a single hung ADB command can block your entire script indefinitely, turning a five-minute job into a stuck process nobody notices until the next day.

Where this fits

Every one of these steps assumes real phones behind real ADB endpoints, not a shared pool of virtual devices you’re hoping behave the same way. On cloudf.one, that means real Samsung handsets on real Singapore mobile IPs, adb per phone through the invite-only tunnel, a REST API for listing and locking devices, and tagged pools you can carve out for CI. Drop the scripts above into your own project and you’re orchestrating ten or fifty phones from a single Python file, which is how a working multi-account stack actually runs day to day.

If you want to see how the fleet and API are set up, start here.

Get new guides and videos first — join the Telegram channel.

40% off until 31 December 2026
Real phones in Singapore, each with its own mobile IP.
Introductory price until 31 December 2026. A dedicated phone straight away, no queue.