ArcGIS Runtime SDK for iOS: AGSGeotrigger Class Reference
ArcGIS Runtime SDK for iOS  100.15
AGSGeotrigger Class Reference

Description

A condition monitored by an AGSGeotriggerMonitor.

An AGSGeotrigger defines a condition that can be continually monitored in real time. After the condition is met, the AGSGeotrigger defines how an AGSGeotriggerNotificationInfo can be used to inform the user.

An AGSGeotriggerMonitor, created with the AGSGeotrigger, handles monitoring and reporting.

You can create an AGSFenceGeotrigger describing target areas, covered by spatial rules such as enter or exit. This type of spatial monitoring is also known as "Geofencing".

If an AGSGeotrigger is defined in an AGSGeotriggersInfo, check whether the AGSGeotriggerFeed is of type AGSLocationGeotriggerFeed and, if so, supply an AGSLocationDataSource to provide your device location. Set the AGSLocationGeotriggerFeed::locationDataSource to your AGSLocationDataSource. For example, using the AGSLocationDisplay::dataSource.

Since
100.12
Inheritance diagram for AGSGeotrigger:
AGSObject AGSFenceGeotrigger

Properties

AGSGeotriggerFeedfeed
 
NSString * geotriggerID
 
AGSArcadeExpressionmessageExpression
 
NSString * name
 
NSArray< NSString * > * requestedActions
 

Property Documentation

◆ feed

- (AGSGeotriggerFeed*) feed
readnonatomicstrong

The AGSGeotriggerFeed that is monitored for changes.

You can construct an AGSLocationGeotriggerFeed from any AGSLocationDataSource. Typically, this shows the device location based on GPS, but can be any AGSLocationDataSource.

Since
100.12

◆ geotriggerID

- (NSString*) geotriggerID
readnonatomiccopy

A unique ID for the AGSGeotrigger.

Since
100.13

◆ messageExpression

- (AGSArcadeExpression*) messageExpression
readwritenonatomicstrong

An AGSArcadeExpression that controls the notification details when an AGSGeotrigger 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 AGSGeotrigger
  • Information that is specific to the attributes of objects that met the AGSGeotrigger

The expression is evaluated whenever the AGSGeotrigger condition is met, in order to populate the AGSGeotriggerNotificationInfo::message property. Display this message to alert the user that the AGSGeotrigger condition has been met. Note that the expression cannot be changed when the AGSGeotriggerMonitor is running.

For example, with an AGSFenceGeotrigger, using the following expression:

"You have " + $fencenotificationtype + " " + $fencefeature.area_name

returns the AGSGeotriggerNotificationInfo::message "You have entered Area A", where "area_name" is an attribute field on the AGSFenceGeotriggerNotificationInfo::fenceGeoElement.

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.

For example, the following expression results in an AGSGeotriggerNotificationInfo::message of: "Hello world" and an AGSGeotriggerNotificationInfo::actions list of either "startTracking" or "stopTracking":

var action = IIf($fencenotificationtype == 'enter', 'stopTracking', 'startTracking');
return {
'message': 'Hello world',
'actions': [ "showMessage", action ]
}

The AGSArcadeExpression must evaluate to either a string or a dictionary; see AGSArcadeExpression::returnType. Note that this property is an AGSArcadeExpression object, rather than a string.

The AGSArcadeExpression must evaluate to either a string or a dictionary - see AGSArcadeExpression::returnType.

For more information on the available profile variables and functions for creating the AGSGeotrigger::messageExpression, see the "Geotrigger Notification" profile at https://developers.arcgis.com/arcade/guide/profiles/.

Since
100.12

◆ name

- (NSString*) name
readwritenonatomiccopy

The name of the AGSGeotrigger.

Since
100.12

◆ requestedActions

- (NSArray<NSString *>*) requestedActions
readwritenonatomiccopy

An array of strings indicating the set of requested actions when a notification is delivered.

This property provides the full list of recommended actions that the AGSGeotrigger 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 AGSGeotrigger author's intention. Use this property to:

  • Display the expected behavior of an AGSGeotrigger to the user, prior to monitoring.
  • Check that your app supports the expected actions for the AGSGeotrigger.

This list of strings is the full set of recommended actions for any notifications from this AGSGeotrigger. Individual AGSGeotriggerNotificationInfo events 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 in AGSGeotriggerNotificationInfo::actions. To populate the array of actions for a notification, the AGSGeotrigger::messageExpression property must return a dictionary with the key "actions", and an array of action strings as the value.

The actions are simple strings, so you can use them to control any custom action you wish your app to perform.

Since
100.14