Class GeotriggerMonitor


  • public class GeotriggerMonitor
    extends java.lang.Object
    A GeotriggerMonitor monitors a Geotrigger condition and, when it is met, results in a GeotriggerNotificationInfo.

    A Geotrigger defines a query that is evaluated against GIS data as it changes in real time. For example, "Notify me when my device location enters one of my target areas" or "Notify me when my device location is within 50 m of my destination".

    A GeotriggerMonitor is created with a Geotrigger that it continually checks to determine whether the condition has been met.

    Once a GeotriggerMonitor is created, you begin checking the condition by calling startAsync(). Once you are finished, call stop(). When a Geotrigger evaluates to true, a GeotriggerMonitorNotificationEvent is sent. You can subscribe to the notification info to receive details of where the Geotrigger was activated and the condition that was met.

    Since:
    100.12.0
    • Constructor Detail

      • GeotriggerMonitor

        public GeotriggerMonitor​(Geotrigger geotrigger)
        Constructs a GeotriggerMonitor with a Geotrigger condition.
        Parameters:
        geotrigger - the Geotrigger which will be monitored
        Throws:
        java.lang.IllegalArgumentException - if geotrigger is null
        Since:
        100.12.0
    • Method Detail

      • getGeotrigger

        public Geotrigger getGeotrigger()
        Gets the Geotrigger that will be monitored.
        Returns:
        the Geotrigger that will be monitored
        Since:
        100.12.0
      • getWarning

        public ArcGISRuntimeException getWarning()
        Gets an error that describes a problem encountered while starting or monitoring the Geotrigger.

        A warning can occur at various stages of monitoring a Geotrigger:

        • When starting the GeotriggerMonitor
        • When accessing the components of the Geotrigger such as the GeotriggerFeed
        • When performing on-going monitoring
        If the problem is resolved, this property will be cleared.

        Problems that occur when starting the GeotriggerMonitor result in a GeotriggerMonitorStatus of GeotriggerMonitorStatus.FAILED_TO_START. These issues must be fixed and start called again before you receive any notifications. For example, if the Geotrigger.getMessageExpression() is an invalid ArcadeExpression, monitoring cannot be carried out.

        Problems that occur when accessing the components of the Geotrigger will not prevent the GeotriggerMonitor from starting. However, until the problem is resolved, you will not receive any notifications. For example, if a LocationGeotriggerFeed uses a LocationDataSource that is not started, you will not receive any notifications. Once the LocationDataSource is successfully started, monitoring will resume. If a FenceParameters has no valid data for a fence you will not receive any notifications.

        Problems that occur during ongoing monitoring relate to issues with individual objects such as the graphics that make up the fences for a GraphicFenceParameters. These warnings do not prevent notifications from being sent for other valid fences. For example, a fence is considered invalid if it has:

        Returns:
        an error that describes a problem encountered while starting or monitoring the Geotrigger, or null if none
        Since:
        100.12.0
      • getInternal

        public com.esri.arcgisruntime.internal.jni.CoreGeotriggerMonitor getInternal()
        Since:
        100.12.0
      • stop

        public void stop()
        Stops evaluating the GeotriggerMonitor.

        Stopping the GeotriggerMonitor prevents the condition from being evaluated and notifications from being sent. If you are using a LocationGeotriggerFeed created from a LocationDataSource, the data source must also be stopped to turn off GPS receivers etc.

        When the GeotriggerMonitor is stopped, the getStatus() will be GeotriggerMonitorStatus.STOPPED.

        Since:
        100.12.0
      • addGeotriggerMonitorNotificationEventListener

        public void addGeotriggerMonitorNotificationEventListener​(GeotriggerMonitorNotificationEventListener listener)
        Registers the given GeotriggerMonitorNotificationEventListener to be called when an update is received from the GeotriggerMonitor.

        Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.

        Parameters:
        listener - the listener to register
        Throws:
        java.lang.IllegalArgumentException - if the GeotriggerMonitorNotificationEventListener is null
        Since:
        100.12.0
        See Also:
        removeGeotriggerMonitorNotificationEventListener(GeotriggerMonitorNotificationEventListener)
      • addGeotriggerMonitorStatusChangedEventListener

        public void addGeotriggerMonitorStatusChangedEventListener​(GeotriggerMonitorStatusChangedEventListener listener)
        Registers the given GeotriggerMonitorStatusChangedEventListener to be called when an update is received from the GeotriggerMonitor.

        Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.

        Parameters:
        listener - the listener to register
        Throws:
        java.lang.IllegalArgumentException - if the GeotriggerMonitorStatusChangedEventListener is null
        Since:
        100.12.0
        See Also:
        removeGeotriggerMonitorStatusChangedEventListener(GeotriggerMonitorStatusChangedEventListener)
      • addGeotriggerMonitorWarningChangedEventListener

        public void addGeotriggerMonitorWarningChangedEventListener​(GeotriggerMonitorWarningChangedEventListener listener)
        Registers the given GeotriggerMonitorWarningChangedEventListener to be called when an update is received from the GeotriggerMonitor.

        Adding this listener on the UI thread will cause it to be invoked on the UI thread, otherwise it is not guaranteed on which thread the listener is invoked.

        Parameters:
        listener - the listener to register
        Throws:
        java.lang.IllegalArgumentException - if the GeotriggerMonitorWarningChangedEventListener is null
        Since:
        100.12.0
        See Also:
        removeGeotriggerMonitorWarningChangedEventListener(GeotriggerMonitorWarningChangedEventListener)