Skip to main content

Location · SetLocation · ClearLocation · FollowRoute · FollowGpx

This tool on every surface: CLI · MCP · Python · JavaScript · Go · Java · .NET

Read where the device believes it is, or place it somewhere. These call app_location.

Location​

public Location Location()

Where the device believes it is. Mock says this fix was injected; Mocking says a test provider is installed now. They differ after ClearLocation, because Android keeps the last known position after the provider supplying it is gone. Android only: simctl location has no get, so on iOS this throws rather than returning a position it never read.

SetLocation​

public void SetLocation(double latitude, double longitude)

Places the device at a coordinate. On Android this goes through a test provider, is read back, and works on real hardware. On iOS it goes through simctl and cannot be confirmed: returning means the request was accepted, not that an app will read it.

ClearLocation​

public void ClearLocation()

Removes the injected position. Does not clear the device's last known location, which Android caches.

FollowRoute​

public void FollowRoute(IEnumerable<double[]> waypoints, double speedMPS)

Moves along two or more waypoints over time, each a (latitude, longitude) pair, at speedMPS meters per second — pass 0 for the default. On iOS the simulator interpolates the route itself; on Android the daemon steps a test provider once a second, the platform having no route command.

FollowGpx​

public void FollowGpx(string path, double speedMPS)

Follows a GPX file, read on the machine running the daemon.

Examples​

Put the device in London​

device.SetLocation(51.5074, -0.1278);

The same call from the command line, mobium location 51.5074 -0.1278, printed on an Android 15 emulator:

the device is at 51.507400,-0.127800, injected and read back

mobium location 51.5074 -0.1278 on an Android 15 emulator

mobium location 51.5074 -0.1278 on an Android 15 emulator

Give it back its own position​

device.ClearLocation();

The same call from the command line, mobium location --clear, printed on an Android 15 emulator:

the test provider is removed — the device will report its own position the next time something asks for one. Its last known location is still the injected one until then; Android keeps that cache and nothing here can clear it