Class Geotrigger
- java.lang.Object
 - 
- com.esri.arcgisruntime.geotriggers.Geotrigger
 
 
- 
- Direct Known Subclasses:
 FenceGeotrigger
public class Geotrigger extends java.lang.ObjectA condition monitored by aGeotriggerMonitor.A
Geotriggerdefines a condition that can be continually monitored in real time. After the condition is met, theGeotriggerdefines how aGeotriggerNotificationInfocan be used to inform the user.A
GeotriggerMonitor, created with theGeotrigger, handles monitoring and reporting.You can create a
FenceGeotriggerdescribing target areas, covered by spatial rules such as enter or exit. This type of spatial monitoring is also known as "Geofencing".If a
Geotriggeris defined in aGeotriggersInfo, check whether theGeotriggerFeedis of typeLocationGeotriggerFeedand, if so, supply aLocationDataSourceto provide your device location. CallLocationGeotriggerFeed.setLocationDataSource(LocationDataSource), passing yourLocationDataSource; you can retrieve your location data source by calling, for example,LocationDisplay.getLocationDataSource(). If a Geotrigger is defined in aGeotriggersInfo, check whether theGeotriggerFeedis of typeLocationGeotriggerFeedand, if so, supply aLocationDataSourceto provide your device location. Set theLocationGeotriggerFeed.getLocationDataSource()to yourLocationDataSource- for example, using theLocationDisplay.setLocationDataSource(LocationDataSource).- Since:
 - 100.12.0
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected GeotriggerFeedmFeedprotected ArcadeExpressionmMessageExpression 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GeotriggerFeedgetFeed()Gets theGeotriggerFeedthat is monitored for changes.java.lang.StringgetGeotriggerId()Gets a unique ID for the Geotrigger.ArcadeExpressiongetMessageExpression()Gets anArcadeExpressionthat controls the notification details when a Geotrigger is met.java.lang.StringgetName()Gets the name of the Geotrigger.java.util.List<java.lang.String>getRequestedActions()Gets a list of strings indicating the set of requested actions when a notification is delivered.voidsetMessageExpression(ArcadeExpression messageExpression)Sets anArcadeExpressionthat controls notification details when aGeotriggeris met.voidsetName(java.lang.String name)Sets the name of the Geotrigger. 
 - 
 
- 
- 
Field Detail
- 
mFeed
protected GeotriggerFeed mFeed
 
- 
mMessageExpression
protected ArcadeExpression mMessageExpression
 
 - 
 
- 
Method Detail
- 
getFeed
public GeotriggerFeed getFeed()
Gets theGeotriggerFeedthat is monitored for changes.You can construct a
LocationGeotriggerFeedfrom anyLocationDataSource. Typically, this shows the device location based on GPS, but can be anyLocationDataSource.- Returns:
 - the 
GeotriggerFeedthat is monitored for changes - Since:
 - 100.12.0
 
 
- 
getGeotriggerId
public java.lang.String getGeotriggerId()
Gets a unique ID for the Geotrigger.- Returns:
 - a unique ID for the Geotrigger
 - Since:
 - 100.13.0
 
 
- 
getMessageExpression
public ArcadeExpression getMessageExpression()
Gets anArcadeExpressionthat controls the notification details when a Geotrigger is met.The expression uses the Arcade language to generate notification information that can be:
- a string literal that is the same for all notifications relating to this 
Geotrigger - information that is specific to the attributes of objects that met the 
Geotrigger 
Geotriggercondition is met, in order to populate theGeotriggerNotificationInfo.getMessage()property. Display this message to alert the user that theGeotriggercondition has been met. Note that the expression cannot be changed when theGeotriggerMonitoris running.For example, with a
FenceGeotrigger, using the following expression:"You have " + $fencenotificationtype + " " + $fencefeature.area_namereturns the
GeotriggerNotification.getMessage()"You have entered Area A", where "area_name" is an attribute field on theFenceGeotriggerNotificationInfo.getFenceGeoElement().Optionally, the expression can return extra properties in addition to the message. For example, it could produce another string, suitable for logging to a database. To supply additional properties, write an arcade expression that evaluates to a dictionary of key value pairs.
- A value with the key "message" will be used to populate the 
GeotriggerNotificationInfo.getMessage()property. - A value with the key "actions" will populate the 
GeotriggerNotificationInfo.getActions()property. - Any additional key value pairs are returned in the 
GeotriggerNotificationInfo.getMessageProperties()dictionary. 
For example, the expression below results in a
GeotriggerNotificationInfo.getMessage()of: "Hello world" and aGeotriggerNotificationInfo.getActions()list of either "startTracking" or "stopTracking":
Thevar action = IIf($fencenotificationtype == 'enter', 'stopTracking', 'startTracking'); return { 'message': 'Hello world', 'actions': [ action ] }ArcadeExpressionmust evaluate to either a string or a dictionary; seeArcadeExpression.getReturnType(). Note that this method —getMessageExpression()— returns anArcadeExpressionobject, rather than a string.For more information on the available profile variables and functions for creating the message expression see the "Geotrigger Notification" profile at https://developers.arcgis.com/arcade/guide/profiles/.
- Returns:
 - an 
ArcadeExpressionthat controls the message when a Geotrigger is met, or null if none - Since:
 - 100.12.0
 - See Also:
 setMessageExpression(ArcadeExpression)
 - a string literal that is the same for all notifications relating to this 
 
- 
setMessageExpression
public void setMessageExpression(ArcadeExpression messageExpression)
Sets anArcadeExpressionthat controls notification details when aGeotriggeris met.The expression uses the Arcade language to generate notification information that can be:
- a string literal that is the same for all notifications relating to this 
Geotrigger - information that is specific to the attributes of objects that met the 
Geotrigger 
Geotriggercondition is met in order to populate theGeotriggerNotificationInfo.getMessage()property. Display this message to alert the user that theGeotriggercondition has been met. Note that the expression cannot be changed when theGeotriggerMonitoris running.For example, with a
FenceGeotrigger, using the following expression:"You have " + $fencenotificationtype + " " + $fencefeature.area_namereturns the
GeotriggerNotificationInfo.getMessage()"You have entered Area A", where "area_name" is an attribute field on theFenceGeotriggerNotificationInfo.getFenceGeoElement().Optionally, the expression can return extra properties in addition to the message. For example, it could produce another string, suitable for logging to a database. To supply additional properties, write an arcade expression that evaluates to a dictionary of key value pairs.
- A value with the key "message" will be used to populate the 
GeotriggerNotificationInfo.getMessage()property. - A value with the key "actions" will populate the 
GeotriggerNotificationInfo.getActions()property. - Any additional key value pairs are returned in the 
GeotriggerNotificationInfo.getMessageProperties()dictionary. 
For example, the expression below results in a
GeotriggerNotificationInfo.getMessage()of: "Hello world" and aGeotriggerNotificationInfo.getActions()list of either "startTracking" or "stopTracking":
Thevar action = IIf($fencenotificationtype == 'enter', 'stopTracking', 'startTracking'); return { 'message': 'Hello world', 'actions': [ action ] }ArcadeExpressionmust evaluate to either a string or a dictionary; seeArcadeExpression.getReturnType(). Note that this method —setMessageExpression()— takes anArcadeExpressionobject, rather than a string.For more information on the available profile variables and functions for creating the message expression see the "Geotrigger Notification" profile at https://developers.arcgis.com/arcade/guide/profiles/. *
- Parameters:
 messageExpression- anArcadeExpressionthat controls the message when a Geotrigger is met- Since:
 - 100.12.0
 - See Also:
 getMessageExpression()
 - a string literal that is the same for all notifications relating to this 
 
- 
getName
public java.lang.String getName()
Gets the name of the Geotrigger.- Returns:
 - the name of the Geotrigger
 - Since:
 - 100.12.0
 
 
- 
setName
public void setName(java.lang.String name)
Sets the name of the Geotrigger.- Parameters:
 name- the name of the Geotrigger- Throws:
 java.lang.IllegalArgumentException- if name is null- Since:
 - 100.12.0
 
 
- 
getRequestedActions
public java.util.List<java.lang.String> getRequestedActions()
Gets a list of strings indicating the set of requested actions when a notification is delivered.This property shows the full list of recommended actions that the Geotrigger author intends to be taken. Note that there is no requirement to take any action when a notification is delivered, but these provide a way to understand the Geotrigger author's intention. Use this property to:
- Display the expected behavior of a Geotrigger to the user, prior to monitoring.
 - Check that your app supports the expected actions for the Geotrigger.
 
GeotriggerNotificationInfoevents may include a subset of these actions. The specific actions for an individual notification event (for example, when a given fence is entered) are shown inGeotriggerNotificationInfo.getActions(). To populate the list of actions for a notification, thegetMessageExpression()must return a dictionary with the key "actions", and a value showing the list of action strings.The list of actions are simple strings, so you can use them to control any custom action you wish your app to perform.
- Returns:
 - a list of strings indicating the set of requested actions when a notification is delivered
 - Since:
 - 100.14.0
 
 
 - 
 
 -