Location
Put the device at a GPS point, play a route or a GPX file at a speed, or run a bundled scenario, from a spec, a suite or warden ui.
warden ui location route plays fixes out of a 150 m geofence; the app gets them from plain expo-location.device.location sets the fix the app gets from the platform's location service, so plain expo-location or CLLocationManager code sees it. A route plays fixes at a speed, which is how a geofence or a run tracker gets exercised.
await device.location.set({ lat: 37.3349, lon: -122.009 });
await device.location.route(
[{ lat: 37.3398, lon: -122.009 }, { lat: 37.3349, lon: -122.009 }, { lat: 37.33, lon: -122.009 }],
{ speedMps: 40, intervalS: 1 },
);
await device.location.route({ gpx: "fixtures/commute.gpx" });
await device.location.scenario("city-run"); // "city-run" | "city-bike" | "freeway"
await device.location.clear();| Call | Does |
|---|---|
set({ lat, lon, altM? }) | a point |
route(points | { gpx }, { speedMps?, intervalS?, loop? }) | waypoints, or a GPX file (relative to the working directory), played at a speed |
scenario(name) | one of the bundled routes |
clear() | iOS clears the simulated location. Android stops the ticker and keeps the last fix (the emulator console cannot unset one) |
How a route plays
On iOS simctl plays a route once. On Android a ticker owned by the lease sends a fix every interval until the next location call, and stops when the lease is released.
In a suite
conditions: { location: "city-run" },location takes { lat, lon, altM? } or a scenario name. Every spec starts from it.
By hand
warden ui location set 37.3349,-122.009
warden ui location route 37.3398,-122.009 37.3349,-122.009 --speed 20
warden ui location gpx ./commute.gpx
warden ui location scenario city-run
warden ui location clearSee warden ui for every flag.
Limitations
routewithloopis unsupported on iOS (E_UNSUPPORTED):simctlhas no loop.- Android keeps the last GPS fix after
clear()and after release: the emulator cannot unset one.