getLocation
Gets the current location or address by reverse geocoding if necessary.
The latitude
and longitude
are available as eventParameters in the onSuccess event.
Field Configurations
Key | Type | Description | Default Value |
---|---|---|---|
"params" (required) | Object | undefined | null |
Parameters
Key | Type | Description | Default Value |
---|---|---|---|
"async" | Boolean | Specifies whether the action should perform asynchronously. | null |
"getAddress" | Boolean,String | Indicates whether the location should be reverse geocoded to an adddress. | false |
"maxAge" | Number,String | The maximum age for the location. No new location will be collected if there is an older one meeting the maxAge criteria. | null |
"onError" | String | Event that is fired in case of an error. | null |
"onErrorType" | OnErrorType | Type of event that will be fired on error. | null |
"onSuccess" (required) | String | Event that is fired in case of success. | null |
"onSuccessType" | OnSuccessType | Type of event that will be fired on success. | null |
"timeout" | Number,String | The action will throw an error if the timeout is exceeded. | 60 |
Inherited
From Base Action
Base Action
Field Configurations
Key | Type | Description | Default Value |
---|---|---|---|
"dynamicParams" | Object | Dynamic params to retrieve data from a specific context e.g. a userSetting. | null |
"leadingDelimiter" | String | The leading mustache delimiter to use. | null |
"params" | Object,Array | Object containing the properties of the action. | null |
"trailingDelimiter" | String | The trailing mustache delimiter to use. | null |
"type" | String | Type name of the action. | null |
Examples
Example 1: Get a location
Goal: Create a getLocation action and reverse geocode the location to an address.
If getAddress
is true
the eventParameters will also include the fields zip
, city
, country
, street
, houseNumber
and address
.
{
"type": "getLocation",
"params": {
"getAddress": true,
"onSuccess": "getLocationSuccess",
"onError": "getLocationError"
}
}
The getAddress
parameter specifies whether the location is to be reverse geocoded to an address.
Result:
A getLocation action has been created.