SpawnDroid

Mock location

Override the device GPS with fixed coordinates so location-aware flows can be tested from the console or the API.

Every SpawnDroid device can report a fixed GPS position. SpawnDroid registers Android test location providers (gps and network) on the device, so any app that reads location sees the coordinates you set instead of the container's own — which, with no radio, is nothing at all.

From the console

Open a session and switch to the Network tab. Under Mock location, pick a preset city, or type a latitude and longitude and press Apply. The device keeps reporting the fix until you press Clear or the session ends.

From the API

Set a fix with a key that has upload scope:

curl -X POST "https://app.spawndroid.io/api/sessions/$SESSION_ID/location" \
  -H "Authorization: Bearer $SPAWNDROID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"location":{"latitude":51.5074,"longitude":-0.1278}}'

Send {"location":null} to clear it and return the device to its own location sources. The same fix can be requested up front when a session is created, so a pipeline can boot a device already positioned:

curl -X POST "https://app.spawndroid.io/api/v1/sessions" \
  -H "Authorization: Bearer $SPAWNDROID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"location":{"latitude":35.6762,"longitude":139.6503}}'

Behaviour and caveats

  • The fix is applied when the device boots and can be changed at any time while the session is live.
  • Both the gps and network providers are overridden, so apps that read fused or network location see it too.
  • Locations are flagged as mock, exactly like an emulator's override. Apps that explicitly reject mock locations will still ignore them.
  • The override lives inside the session's isolation boundary and never reaches another session.

On this page