Alexa 地理位置

Alexa Geographic location

我正在尝试在 Alexa 技能中获取地理位置。 我在 Alexa 控制台中启用了定位服务,并且我已授权发送地理位置的技能。

我收到的消息如下:

{
  "context": {
    "Extensions": {
      "available": {}
    },
    "System": {
      "application": {
        "applicationId": "..."
      },
      "device": {
        "supportedInterfaces": {},
        "deviceId": "..."
      },
      "apiEndpoint": "https://api.eu.amazonalexa.com",
      "user": {
        "userId": "...",
        "permissions": {
          "scopes": {
            "alexa::devices:all:geolocation:read": {
              "status": "GRANTED"
            }
          },
          "consentToken": "..."
        }
      },
      "apiAccessToken": "...",
      "unit": {
        "unitId": "..."
      }
    }
  },
  "version": "1.0",
  "session": {
    "application": {
      "applicationId": "..."
    },
    "user": {
      "userId": "...",
      "permissions": {
        "scopes": {
          "alexa::devices:all:geolocation:read": {
            "status": "GRANTED"
          }
        },
        "consentToken": "..."
      }
    },
    "new": true,
    "sessionId": "..."
  },
  "request": {
    "requestId": "...",
    "locale": "it-IT",
    "intent": {
      "name": "MyIntent",
      "confirmationStatus": "NONE"
    },
    "type": "IntentRequest",
    "timestamp": "2021-01-28T07:39:53Z"
  }
}

如您所见,地理位置已获授权,但 here 描述的地理位置字段完全缺失。

您关于地理定位不适用于大多数 Echo 设备的说法是正确的。固定设备只提供注册地址,不提供地理坐标。

https://developer.amazon.com/en-US/docs/alexa/custom-skills/location-services-for-alexa-skills.html#device-address-as-compared-to-geo-coordinates

但是,您可以使用“地理编码”服务将大多数 地址转换为坐标。例如 Google Maps has a geocoding API.