Skip to main content
Version: 4.62

addGeofences

Adds a geofence too look for.

Field Configurations

KeyTypeDescriptionDefault Value
"params" (required)Objectundefinednull

Parameters

KeyTypeDescriptionDefault Value
"async"BooleanSpecifies whether the action should perform asynchronously.null
"fences"ArrayThe list of the geofences.null
"query"StringThe table querynull
"queryParams"ArrayThe list of the appended query parameters.null
"table"StringThe database table.null
"template"StringTemplate to apply to the query result.null

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: Add a geofence

Show ExampleHide Example

Add a geofence based on the data provided by the user.

{
"type": "addGeofences",
"params": {
"table": "geofences",
"query": "all",
"template": "addGeofence"
}
}
{
"name": "addGeofence",
"content": {
"id": "{{id}}",
"latitude": "{{latitude}}",
"longitude": "{{longitude}}",
"radius": "{{radius}}",
"showWhileInBackground": false,
"showOnceInSeconds": 10,
"showOnceInSecondsEnter": 10,
"showOnceInSecondsExit": 10,
"maxAge": 3,
"events": [
{
"type": "enterRegion",
"actions": [
{
"type": "if",
"params": {
"condition": {
"left": "{{enterNotification}}",
"mode": "equals",
"right": "true"
}
},
"then": [
{
"type": "showMessage",
"params": {
"title": "$lang(geofenece02Content09)$ {{name}}",
"text": "$lang(geofenece02Content10)$",
"asNotification": true
}
}
],
"else": [
{
"type": "noAction"
}
]
}
]
},
{
"type": "exitRegion",
"actions": [
{
"type": "if",
"params": {
"condition": {
"left": "{{exitNotification}}",
"mode": "equals",
"right": "true"
}
},
"then": [
{
"type": "showMessage",
"params": {
"title": "$lang(geofenece02Content11)$ {{name}}",
"text": "$lang(geofenece02Content12)$",
"asNotification": true
}
}
],
"else": [
{
"type": "noAction"
}
]
}
]
}
]
}
}
The app showing the results of the sample code from Example 1.The app showing the results of the sample code from Example 1.

The data is first stored in the geofences database table. The addGeofences action then retrieves the data from the database table and uses the specified template.