Set location command

Sets the device location. This enables testing a location-aware app that uses location services without moving the device from place to place to generate location data.

To learn more about location injection, including requirements and limitations, see Location injection overview.

Tip: To obtain Google coordinates for an address, use Google Maps.

Parameters

Name Type Possible values Description

Device ID*

Device

 

The device for this command. By default, this is the device under test (DUT).

Address

String  

The address location to set. Format: Google Geocoding.

Example: 1600 Amphitheatre Parkway, Mountain View, CA

Lat,Long

String

 

The latitude and longitude coordinate of the device location to set.

Example: 43.642659,-79.387050

Comment

String

 

Adds a comment to the script.

On-fail Result*

Condition

Ignore | Break | Continue | Abort | Catch

The behavior when the command fails.

* Mandatory

Troubleshooting

If the Set location command does not work:

  • Confirm that the Reset Location parameter is set to false.
  • Open, close, and reopen the application in which the location is set.

Caution: On iOS devices, do not click the Reset Location & Privacy, or the device will become unavailable until addressed by the Perfecto device team.

Android Troubleshooting

Verify the following settings in the device:

  1. Allow mock locations: Go to Settings > Developer options > Allow mock locations.

  2. High accuracy: Go to Setting > Location > Mode > High accuracy.