> ## Documentation Index
> Fetch the complete documentation index at: https://devzone.nayax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# getLocation

> 获取设备的 GPS 位置以支持基于位置的终端功能。

`getLocation` 方法检索设备的当前地理位置，包括纬度、经度、精度和读取时间。

## 请求

> [!NOTE]
>
> **JSON-RPC 2.0**
>
> TweezerComm 中的所有方法都遵循 JSON-RPC 2.0 结构。有关如何构建和发送请求的更多详情，请参阅[开始](/docs/integrate-pos-device/tweezercomm/tweezercomm-get-started.md)。

在请求中，`method` 字段需要设置为 `getLocation`，如下例所示：

```json theme={null}
{
    "jsonrpc": "2.0",
    "method": "getLocation",
    "params": [
        "device"
    ],
    "id": "101"
}
```

### 请求参数

下表描述此方法的请求参数：

| Name | Type | Description |
| - | - | - |
| `params` | array | 必须包含值 `device` |

## 响应

成功的请求将返回以下响应：

```json theme={null}
{
    "jsonrpc": "2.0",
    "id": "101",
    "result": {
        "statusCode": 0,
        "statusMessage": "",
        "latitude": "32.0879",
        "longitude": "34.7999",
        "accuracy": "12.4",
        "timestamp": "1751443200000"
    }
}
```

### 响应参数

下表描述此方法的响应参数：

| Name | Type | Description |
| - | - | - |
| `statusCode` | integer | 操作状态（0 = 成功） |
| `statusMessage` | string | 操作结果消息 |
| `latitude` | string | 设备位置的纬度坐标。 |
| `longitude` | string | 设备位置的经度坐标。 |
| `accuracy` | string | 位置读取精度，单位为米。 |
| `timestamp` | string | 位置被记录时的 Epoch 时间戳（毫秒）。 |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.