Class GeotriggerMonitor
- java.lang.Object
-
- com.esri.arcgisruntime.geotriggers.GeotriggerMonitor
-
public class GeotriggerMonitor extends Object
A GeotriggerMonitor monitors aGeotrigger
condition and, when it is met, results in aGeotriggerNotificationInfo
.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, callstop()
. When aGeotrigger
evaluates to true, aGeotriggerMonitorNotificationEvent
is sent. You can subscribe to the notification info to receive details of where theGeotrigger
was activated and the condition that was met.- Since:
- 100.12.0
-
-
Constructor Summary
Constructors Constructor Description GeotriggerMonitor(Geotrigger geotrigger)
Constructs a GeotriggerMonitor with aGeotrigger
condition.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGeotriggerMonitorNotificationEventListener(GeotriggerMonitorNotificationEventListener listener)
Registers the given GeotriggerMonitorNotificationEventListener to be called when an update is received from the GeotriggerMonitor.void
addGeotriggerMonitorStatusChangedEventListener(GeotriggerMonitorStatusChangedEventListener listener)
Registers the given GeotriggerMonitorStatusChangedEventListener to be called when an update is received from the GeotriggerMonitor.void
addGeotriggerMonitorWarningChangedEventListener(GeotriggerMonitorWarningChangedEventListener listener)
Registers the given GeotriggerMonitorWarningChangedEventListener to be called when an update is received from the GeotriggerMonitor.Geotrigger
getGeotrigger()
Gets theGeotrigger
that will be monitored.com.esri.arcgisruntime.internal.jni.CoreGeotriggerMonitor
getInternal()
GeotriggerMonitorStatus
getStatus()
Gets the current monitoring status of the GeotriggerMonitor.ArcGISRuntimeException
getWarning()
Gets an error that describes a problem encountered while starting or monitoring theGeotrigger
.boolean
removeGeotriggerMonitorNotificationEventListener(GeotriggerMonitorNotificationEventListener listener)
Unregisters the given GeotriggerMonitorNotificationEventListener that was previously added usingaddGeotriggerMonitorNotificationEventListener(GeotriggerMonitorNotificationEventListener)
.boolean
removeGeotriggerMonitorStatusChangedEventListener(GeotriggerMonitorStatusChangedEventListener listener)
Unregisters the given GeotriggerMonitorStatusChangedEventListener that was previously added usingaddGeotriggerMonitorStatusChangedEventListener(GeotriggerMonitorStatusChangedEventListener)
.boolean
removeGeotriggerMonitorWarningChangedEventListener(GeotriggerMonitorWarningChangedEventListener listener)
Unregisters the given GeotriggerMonitorWarningChangedEventListener that was previously added usingaddGeotriggerMonitorWarningChangedEventListener(GeotriggerMonitorWarningChangedEventListener)
.ListenableFuture<Void>
startAsync()
Starts evaluating the GeotriggerMonitor.void
stop()
Stops evaluating the GeotriggerMonitor.
-
-
-
Constructor Detail
-
GeotriggerMonitor
public GeotriggerMonitor(Geotrigger geotrigger)
Constructs a GeotriggerMonitor with aGeotrigger
condition.- Parameters:
geotrigger
- theGeotrigger
which will be monitored- Throws:
IllegalArgumentException
- if geotrigger is null- Since:
- 100.12.0
-
-
Method Detail
-
getGeotrigger
public Geotrigger getGeotrigger()
Gets theGeotrigger
that will be monitored.- Returns:
- the
Geotrigger
that will be monitored - Since:
- 100.12.0
-
getStatus
public GeotriggerMonitorStatus getStatus()
Gets the current monitoring status of the GeotriggerMonitor.A GeotriggerMonitor begins with a monitoring status of
GeotriggerMonitorStatus.STOPPED
and changes toGeotriggerMonitorStatus.STARTED
when you callstartAsync()
. When you callstop()
, the monitoring status changes toGeotriggerMonitorStatus.STOPPED
.- Returns:
- the current monitoring status of the GeotriggerMonitor
- Since:
- 100.12.0
-
getWarning
public ArcGISRuntimeException getWarning()
Gets an error that describes a problem encountered while starting or monitoring theGeotrigger
.A warning can occur at various stages of monitoring a
Geotrigger
:- When starting the GeotriggerMonitor
- When accessing the components of the
Geotrigger
such as theGeotriggerFeed
- When performing on-going monitoring
Problems that occur when starting the GeotriggerMonitor result in a
GeotriggerMonitorStatus
ofGeotriggerMonitorStatus.FAILED_TO_START
. These issues must be fixed and start called again before you receive any notifications. For example, if theGeotrigger.getMessageExpression()
is an invalidArcadeExpression
, 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 aLocationGeotriggerFeed
uses aLocationDataSource
that is not started, you will not receive any notifications. Once theLocationDataSource
is successfully started, monitoring will resume. If aFenceParameters
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:- An empty
Geometry
- A missing
SpatialReference
- A point or polyline
Geometry
and a buffer distance of 0.
- 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
-
startAsync
public ListenableFuture<Void> startAsync()
Starts evaluating the GeotriggerMonitor.When the GeotriggerMonitor is successfully performing checks, the
GeotriggerMonitorStatus
will beGeotriggerMonitorStatus.STARTED
.- Returns:
- a
ListenableFuture
indicating when the GeotriggerMonitor has started - 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 aLocationDataSource
, the data source must also be stopped to turn off GPS receivers etc.When the GeotriggerMonitor is stopped, the
getStatus()
will beGeotriggerMonitorStatus.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:
IllegalArgumentException
- if the GeotriggerMonitorNotificationEventListener is null- Since:
- 100.12.0
- See Also:
removeGeotriggerMonitorNotificationEventListener(GeotriggerMonitorNotificationEventListener)
-
removeGeotriggerMonitorNotificationEventListener
public boolean removeGeotriggerMonitorNotificationEventListener(GeotriggerMonitorNotificationEventListener listener)
Unregisters the given GeotriggerMonitorNotificationEventListener that was previously added usingaddGeotriggerMonitorNotificationEventListener(GeotriggerMonitorNotificationEventListener)
.- Parameters:
listener
- the listener to unregister- Returns:
- true if the listener was successfully removed; false otherwise
- Since:
- 100.12.0
-
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:
IllegalArgumentException
- if the GeotriggerMonitorStatusChangedEventListener is null- Since:
- 100.12.0
- See Also:
removeGeotriggerMonitorStatusChangedEventListener(GeotriggerMonitorStatusChangedEventListener)
-
removeGeotriggerMonitorStatusChangedEventListener
public boolean removeGeotriggerMonitorStatusChangedEventListener(GeotriggerMonitorStatusChangedEventListener listener)
Unregisters the given GeotriggerMonitorStatusChangedEventListener that was previously added usingaddGeotriggerMonitorStatusChangedEventListener(GeotriggerMonitorStatusChangedEventListener)
.- Parameters:
listener
- the listener to unregister- Returns:
- true if the listener was successfully removed; false otherwise
- Since:
- 100.12.0
-
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:
IllegalArgumentException
- if the GeotriggerMonitorWarningChangedEventListener is null- Since:
- 100.12.0
- See Also:
removeGeotriggerMonitorWarningChangedEventListener(GeotriggerMonitorWarningChangedEventListener)
-
removeGeotriggerMonitorWarningChangedEventListener
public boolean removeGeotriggerMonitorWarningChangedEventListener(GeotriggerMonitorWarningChangedEventListener listener)
Unregisters the given GeotriggerMonitorWarningChangedEventListener that was previously added usingaddGeotriggerMonitorWarningChangedEventListener(GeotriggerMonitorWarningChangedEventListener)
.- Parameters:
listener
- the listener to unregister- Returns:
- true if the listener was successfully removed; false otherwise
- Since:
- 100.12.0
-
-