Use device.setGeoLocation() to override the emulator’s GPS coordinates during a flow. This lets you test location-aware features — such as store finders, delivery zones, or region-specific content — without physically moving a device.
See the Android Device Reference for the full setGeoLocation API.
Examples
Set a GPS location
When to use
- Your app shows location-aware content such as store finders, delivery zones, or regional pricing.
- Your app restricts features by geography and you need to test from a specific location.
- Your app uses GPS coordinates to personalize content and you need to assert on that behavior.
- Your test needs to simulate a device in a different city or country.
Troubleshooting
Some apps don’t immediately respond to a location change. Try one or more of the following.
Grant location permissions automatically
Pass autoGrantPermissions: true in your launch options.
Toggle location services
Reload the session
Prime location tracking via Google Maps
Some apps rely on the system location provider being active. Open Google Maps and trigger location tracking before your app reads the location, then reload the session.
Full sample test
Last modified on May 20, 2026