Skip to main content

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

KeyTypeDescriptionDefault Value
"params" (required)Objectundefinednull

Parameters

KeyTypeDescriptionDefault Value
"async"BooleanSpecifies whether the action should perform asynchronously.null
"getAddress"Boolean,StringIndicates whether the location should be reverse geocoded to an adddress.false
"maxAge"Number,StringThe maximum age for the location. No new location will be collected if there is an older one meeting the maxAge criteria.null
"onError"StringEvent that is fired in case of an error.null
"onErrorType"OnErrorTypeType of event that will be fired on error.null
"onSuccess" (required)StringEvent that is fired in case of success.null
"onSuccessType"OnSuccessTypeType of event that will be fired on success.null
"timeout"Number,StringThe action will throw an error if the timeout is exceeded.60

Inherited

From Base Action

Base Action

Field Configurations

KeyTypeDescriptionDefault Value
"dynamicParams"ObjectDynamic params to retrieve data from a specific context e.g. a userSetting.null
"leadingDelimiter"StringThe leading mustache delimiter to use.null
"params"Object,ArrayObject containing the properties of the action.null
"trailingDelimiter"StringThe trailing mustache delimiter to use.null
"type"StringType 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.