devicerent-connect
v0.1.1
Published
Make a rented DeviceRent phone show up as a local adb device, so Appium / Espresso / Maestro / gradle just work against it.
Maintainers
Readme
devicerent-connect
Make a rented DeviceRent phone show up as a local adb device, so your
existing Appium / Espresso / Maestro / Flutter / gradle setup works against it
unchanged — locally or in CI.
It runs a tiny local adb-server emulator and tunnels everything to the device
over DeviceRent's serial-pinned bridge. Your tools just point at it with
ANDROID_ADB_SERVER_PORT.
How it works
appium / gradle / maestro
│ (ANDROID_ADB_SERVER_PORT=15037, standard adb host protocol)
▼
devicerent-connect ──HTTPS──▶ /api/automation/ticket (API key → serial-scoped JWT)
│ (one WebSocket per adb conversation, JWT in subprotocol)
▼
Pi bridge (Model A) ──▶ adb-server ──USB──▶ your rented PixelThe connector handles adb forward itself (binding the listen port on your
machine, then tunneling each connection to the device) — which is what lets
Appium reach the on-device UiAutomator2 server.
Prerequisites
- Node 18+ (for the npm usage) — or use the Docker image.
- Recent platform-tools (
adb≥ 34 recommended; the connector reports the Pi's adb-server version, so very old clients may refuse it). - A DeviceRent automation API key — create one at
<app>/account/automation(Pro / Rent-a-Slot / Enterprise plans). - An active rental — start it in the dashboard and copy its rental id.
Install
Three ways, pick what fits:
# 1. npx — no install (recommended for trying it / CI)
npx devicerent-connect --key drauto_… --rental <rental-id>
# 2. global install
npm i -g devicerent-connect && devicerent-connect --key drauto_… --rental <id>
# 3. Docker (CI-friendly, no Node on the host)
docker build -t devicerent-connect . # from clients/devicerent-connect/From source (this repo): node clients/devicerent-connect/bin/devicerent-connect.mjs --help.
Usage
npx devicerent-connect --key drauto_xxxxxxxx… --rental <rental-id>
# or with env vars:
export DEVICERENT_API_KEY=drauto_xxxxxxxx…
export DEVICERENT_RENTAL_ID=<rental-id>
npx devicerent-connectIt prints:
✓ Connected — rented device 33071JEHN24029 is now a local adb device.
export ANDROID_ADB_SERVER_PORT=15037Then, in the same shell:
export ANDROID_ADB_SERVER_PORT=15037
adb devices # → 33071JEHN24029 device
appium # caps: appium:udid=33071JEHN24029, automationName=UiAutomator2
./gradlew connectedAndroidTest # Espresso / instrumentation
maestro test flow.yamlLeave the connector running while you test; Ctrl-C disconnects.
Options / env
| Flag | Env | Default |
|---|---|---|
| --key | DEVICERENT_API_KEY | — (required) |
| --rental | DEVICERENT_RENTAL_ID | — (required) |
| --port | DEVICERENT_ADB_PORT | 15037 |
| --api-base | DEVICERENT_API_BASE | https://devicerent.net |
CI (Docker)
docker build -t devicerent-connect .
# run the connector + your tests in the same container/network:
docker run --rm \
-e DEVICERENT_API_KEY=$DEVICERENT_API_KEY \
-e DEVICERENT_RENTAL_ID=$RENTAL_ID \
devicerent-connectPut the key in your CI secrets — never commit it. A full GitHub Actions
example (start connector → wait for device → run tests) is in
examples/github-actions.yml.
Limitations (v1)
- Forward-only.
adb reverseis intentionally unsupported (the bridge denies it — it would point the device back at the Pi). Frameworks that require reverse (e.g. Detox) aren't supported yet; Appium/Espresso/Maestro/Flutter use forward. - ~10-minute token window per operation. The connector continuously re-mints, so newly started operations always get close to a full window, but a single unbroken operation that runs longer than the token TTL may be cut. (Hosted Appium — coming — avoids this by running on the Pi.)
- One device. A key + rental maps to exactly the one rented phone.
adb reverse, wirelessadb tcpip, and multi-device selection are not exposed.
Security
- The API key is only ever sent to your DeviceRent app over HTTPS to mint short-lived tokens; it never reaches the Pi.
- Tokens are serial-scoped and expire in ~10 minutes; revoke a key any time at
<app>/account/automation. - The local adb server binds
127.0.0.1only.
