Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

aws lambda - Alexa Geographic location

I am trying to get geographic location in an Alexa skill. I have enabled location services in the Alexa console and I have authorized the skill to send geographic location.

The message I receive is the following:

{
  "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"
  }
}

As you may see, the geographic location is GRANTED but the Geolocation field described here is completely missing.

question from:https://stackoverflow.com/questions/65933039/alexa-geographic-location

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You're correct on geolocation not being available for most Echo devices. Stationary devices only provide the registered address, not geographic coordinates.

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

You can, however use a "geocoding" service to convert most addresses to coordinates. For example Google Maps has a geocoding API.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...