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.

The location is supplied as one of the following: Full (street, city, state, country) or partial address OR Latitude, Longitude pair

To set the location via address: This requires using Google Geocoding. For example: 1600 Amphitheatre Parkway, Mountain View, CA.

To set the location via GPS: Many applications supply GPS coordinates when given an address following Google's Geocoding format. For example: Google Maps yields the GPS coordinates 43.642752 (latitude), -79.386981 (longitude) - decimal degrees - for the address "1600 Amphitheatre Parkway, Mountain View, CA."

When you obtain GPS coordinates, you can set the device location via the Set device location command.

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 parameter

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.