Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.2k views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...