Set or clear a mock location
mobile_locationSets or clears GPS location on Android emulators and devices via ADB for location app testing; clear removes the injected test provider.
Instructions
On an emulator, set uses adb emu geo fix (longitude then latitude). Clearing an emulator fix fails because the console has no clear. On a device, set requires Android 12 (API 31) and injects a gps test provider via cmd location. Fused location clients can ignore that provider. clear removes it.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"serial": "<serial>"
},
"name": "mobile_location"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | No | set | |
| serial | Yes | Exact ADB serial from mobile_devices_list; never inferred when multiple devices exist | |
| latitude | No | ||
| longitude | No | ||
| accuracyMeters | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| backend | No | ||
| cleared | No | ||
| warning | No | ||
| latitude | No | ||
| longitude | No |