Skip to content

setLocation ​

Set the device GPS location to specific coordinates for location testing.

Partial support in Astra Scout

Android devices and emulators, and iOS Simulators, are supported. On a real iPhone the command fails because Apple provides no way to override GPS on a physical device.

The setLocation command applies a mock geolocation to the device.

Arguments ​

The following arguments are available for the setLocation command.

ArgumentDescription
latitudeThe latitude coordinate.
longitudeThe longitude coordinate.

Usage examples ​

The following example sets the device's location to Amsterdam.

yaml
- setLocation:
    latitude: 52.3599976
    longitude: 4.8830301

Limitations ​

Keep the following limitations in mind when using setLocation:

  • On Android, this command requires API level 31 or higher.
  • The command only updates the device's coordinate-based location. Services that rely on IP-based geolocation are not affected.