Geotrigger Class

GeotriggerMonitor."> Geotrigger Class | ArcGISQtCpp
  • Geotrigger
  • class Esri::ArcGISRuntime::Geotrigger

    A condition monitored by a GeotriggerMonitor. More...

    Header: #include <Geotrigger.h>
    Since: Esri::ArcGISRuntime 100.12
    Inherits: Esri::ArcGISRuntime::Object
    Inherited By:


    Public Functions

    virtual ~Geotrigger() override
    Esri::ArcGISRuntime::GeotriggerFeed *feed() const
    QString geotriggerId() const
    Esri::ArcGISRuntime::GeotriggerType geotriggerType() const
    Esri::ArcGISRuntime::ArcadeExpression *messageExpression() const
    QString name() const
    QStringList requestedActions() const
    void setMessageExpression(Esri::ArcGISRuntime::ArcadeExpression *messageExpression)
    void setName(const QString &name)
    void setRequestedActions(const QStringList &requestedActions)

    Detailed Description

    A Geotrigger defines a condition that can be continually monitored in real-time. After the condition is met, the Geotrigger defines how a GeotriggerNotificationInfo can be used to inform the user.

    A GeotriggerMonitor, created with the Geotrigger, handles monitoring and reporting.

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

    If a Geotrigger is defined in a GeotriggersInfo, check whether the GeotriggerFeed is of type LocationGeotriggerFeed and, if so, supply an AbstractLocationDataSource to provide your device location. Set the LocationGeotriggerFeed::locationDataSource to your AbstractLocationDataSource - for example, using the LocationDisplay::dataSource.

    Member Function Documentation

    [override virtual] Geotrigger::~Geotrigger()


    Esri::ArcGISRuntime::GeotriggerFeed *Geotrigger::feed() const

    Returns the GeotriggerFeed that is monitored for changes.

    You can construct a LocationGeotriggerFeed from any AbstractLocationDataSource. Typically, this shows the device location based on GPS, but can be any AbstractLocationDataSource.

    [since Esri::ArcGISRuntime 100.13] QString Geotrigger::geotriggerId() const

    Returns a unique ID for the Geotrigger.

    This function was introduced in Esri::ArcGISRuntime 100.13.

    Esri::ArcGISRuntime::GeotriggerType Geotrigger::geotriggerType() const

    Returns the type of geotrigger.

    The type for a specific Geotrigger object.

    Esri::ArcGISRuntime::ArcadeExpression *Geotrigger::messageExpression() const

    Returns an ArcadeExpression that 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

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

    For example, with a FenceGeotrigger, using the following expression:

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

    returns the GeotriggerNotificationInfo::message "You have entered Area A", where "area_name" is an attribute field on the FenceGeotriggerNotificationInfo::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, this expression results in a GeotriggerNotificationInfo::message of: "Hello world" and a GeotriggerNotificationInfo::actions list of either "startTracking" or "stopTracking".

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

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

    For more information on the available profile variables and functions for creating the messageExpression, see the "Geotrigger Notification" profile at

    See also setMessageExpression().

    QString Geotrigger::name() const

    Returns the name of the Geotrigger.

    See also setName().

    [since Esri::ArcGISRuntime 100.14] QStringList Geotrigger::requestedActions() const

    Returns 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.

    This list of strings shows the full set of recommended actions for any notifications from this Geotrigger. Individual GeotriggerNotificationInfo 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 GeotriggerNotificationInfo::actions. To populate the list of actions for a notification, the messageExpression 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.

    This function was introduced in Esri::ArcGISRuntime 100.14.

    See also setRequestedActions().

    void Geotrigger::setMessageExpression(Esri::ArcGISRuntime::ArcadeExpression *messageExpression)

    Sets the messageExpression to messageExpression.

    See also messageExpression.

    void Geotrigger::setName(const QString &name)

    Sets the name to name.

    See also name.

    [since Esri::ArcGISRuntime 100.14] void Geotrigger::setRequestedActions(const QStringList &requestedActions)

    Sets the requestedActions to requestedActions.

    This function was introduced in Esri::ArcGISRuntime 100.14.

    See also requestedActions.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.