Skip to main content
Put a session in the state your test needs before the app opens:
  • Appearance: light or dark mode.
  • Permissions: grant, revoke, or reset camera, location, notifications, and other privacy permissions for one app, so no system prompt interrupts the run.
  • Push (iOS): deliver an APNs payload to an app, as if it came from Apple.
Each control works through the CLI, the TypeScript SDK, and the REST API, and returns once the device has accepted it.

Appearance

iOS runs simctl ui appearance. Android runs cmd uimode night yes|no. Apps that follow the system setting redraw at once. Some apps read it only at launch.

Permissions

The body takes bundleId (iOS) or packageName (Android), one service, and an action: grant, revoke, or reset. reset returns the permission to “not asked”, so the app shows its prompt again. The CLI sends one request per service and stops at the first failure. On Android the app must be installed and must declare the permission in its manifest. A grant does not survive an app reinstall.

Push notifications (iOS)

Write an APNs payload with an aps object. The limit is 4 KiB, the same as APNs.
payload.json
The host gives the payload to simctl push as data. The app receives it as a remote notification. Grant notifications first, or the banner does not appear. A simulated push does not go through APNs, so it does not test your server’s APNs credentials or device tokens.

Android

POST /run-cloud/android/:id/push returns 501 push_unsupported. Android apps receive push messages through Firebase Cloud Messaging, and FCM delivery needs Google Play services on the device. run.cloud does not pretend to deliver one. To test push on Android, send a real FCM message from your own server to the app’s registration token, on an emulator image that has Google Play services.

Responses

A successful reply names the session, device, and lease, and echoes the change:
appearance replies carry "appearance": "dark". push replies carry "push": { "appId": "…", "payloadBytes": 87 }.

Validation

run.cloud checks every value before it reaches the device:
  • mode, service, and action must be one of the values listed above.
  • An app identifier must match ^[A-Za-z0-9._-]{1,255}$.
  • A push payload must be a JSON object with an aps object, at most 4096 bytes.
The device runs each control as a fixed command with these values as separate arguments. It never builds a shell command from them.

Errors

Failures return ok: false, action (appearance, permissions, or push), and error.code:

What is kept

Appearance and permissions stay set until you change them or the session ends. A saved state does not include them, so set them again after a restore.