# Preview an Expo app on a cloud phone

Run your Expo project on a Mobilebox Android phone: start Metro with a tunnel, open its link with one action, and the
phone gets the Expo Go that matches your project's SDK. Edits show up with Fast Refresh, as on a phone on your desk.
Your agent can then read the screen, tap through the app and check its logs.

## Expo Go in three steps

1. Start Metro with a tunnel, so a phone outside your network reaches it:

   ```sh
   npx expo start --tunnel
   ```

   It prints a link like `exp://abc1234-anonymous-8081.exp.direct`. A LAN link (`exp://192.168.…`) is out of a cloud
   phone's reach.

2. Make a phone (or use one you have):

   ```sh
   curl -X POST https://mobilebox.dev/v1/phones -H "Authorization: Bearer $MOBILESANDBOX_API_KEY"
   ```

3. Open the link:

   ```sh
   curl -X POST https://mobilebox.dev/v1/phones/$PHONE/actions \
     -H "Authorization: Bearer $MOBILESANDBOX_API_KEY" -H "Content-Type: application/json" \
     -d '{"actions": [{"type": "open_url", "url": "exp://abc1234-anonymous-8081.exp.direct"},
                      {"type": "wait_for", "text": "Open up App.js", "timeout_ms": 30000}]}'
   ```

   Over MCP it is the same action: `act {"phone_id": "…", "actions": [{"type": "open_url", "url": "exp://…"}]}`.

The first open on a phone reads your dev server's manifest for the SDK version, installs that SDK's Expo Go from
Expo's official release, and says so in the result's note: `Installed Expo Go 58.0.6 (SDK 58).` Later opens skip the
install. A project on another SDK replaces it with the right one (`… in place of 57.0.9`). On a fresh phone the install,
the first bundle and the first screen took 22 s (25 November 2026); wait for a text your first screen shows, as above.

A freshly installed Expo Go opens its developer menu intro over your app the first time. Tap **Continue**, then
**Close**:

```json
[{"type": "tap", "target": {"text": "Continue"}}, {"type": "tap", "target": {"text": "Close"}}]
```

Save a file and Fast Refresh shows the change on the phone within a second or two: `wait_for` the new text.

## What opens how

| Link | What happens first |
|---|---|
| `exp://…`, `exps://…` (Metro, EAS Update) | Expo Go of the project's SDK is installed if the phone lacks it |
| `https://expo.dev/…` | Expo Go is installed if the phone has none (the newest release) |
| `myapp://…`, `https://…` | Nothing: the link opens in the app that takes it |

Expo Go supports the SDKs Expo still ships it for. An older project gets `expo_sdk_unsupported`: upgrade it, or use a
development build.

## Development builds

A development build is your own APK with `expo-dev-client`, so native modules outside Expo Go work too.

1. Build it once for Android (`eas build --profile development --platform android`) and install the APK from its
   download link: `install_app {"url": "https://…apk"}` (MCP) or `POST /v1/phones/{id}/apps {"url": "…"}`.
2. Start Metro for it: `npx expo start --dev-client --tunnel`.
3. Open the build at your dev server with its own scheme:
   `{"type": "open_url", "url": "myapp://expo-development-client/?url=https%3A%2F%2Fabc1234-anonymous-8081.exp.direct"}`.

The phones run arm64 and 32-bit ARM apps; EAS development builds include arm64.

## Checking the app

- `observe` lists the screen's elements; `act` taps and types by their text.
- `app_logs {"package": "host.exp.exponent"}` shows Expo Go's log, your `console.log` lines and red-box errors included
  (a development build: its own package).
- `watch_phone` gives you a live view link to watch the agent work, or to take over.

## Errors

| Code | Means | Next |
|---|---|---|
| `expo_unreachable` | The dev server did not answer from the internet | `npx expo start --tunnel`, then the link it prints now |
| `expo_manifest_unreadable` | It answered, but not with an Expo manifest | Check Metro still runs; tunnel links change on restart |
| `expo_sdk_unsupported` | Expo has no released Expo Go for that SDK | Upgrade the SDK, or use a development build |
| `no_app_for_url` | No app on the phone opens that scheme | Install the app that does, then open the link again |

iOS simulators don't open links yet (`not_on_ios`).
