Class LocationGeotriggerFeed

java.lang.Object
com.esri.arcgisruntime.geotriggers.GeotriggerFeed
com.esri.arcgisruntime.geotriggers.LocationGeotriggerFeed

public final class LocationGeotriggerFeed extends GeotriggerFeed
Feed data for a Geotrigger created from a LocationDataSource.

The GeotriggerFeed is the dynamic component of a Geotrigger. Typically, it is the data that moves around and triggers the condition. For example, if the condition is "notify me when my position comes within 50 meters of one of my target areas", the feed data is "my position".

To receive location updates, the underlying location data source must be started. If you call GeotriggerMonitor.stop(), the underlying LocationDataSource will not be stopped for you. For example, it may continue to receive GPS readings.

If the LocationGeotriggerFeed is from a Geotrigger defined in a GeotriggersInfo, you must supply a LocationDataSource to provide the device location. Set the getLocationDataSource() to your LocationDataSource - for example, using the LocationDisplay.setLocationDataSource(LocationDataSource).

A FenceGeotrigger can also take into account floors within buildings. If the feature table used to create the FeatureFenceParameters is referenced by a FeatureLayer that is FloorAware, and the LocationDataSource used to create the GeotriggerFeed includes floor information, then fences will only be entered when they are intersected by a LocationDataSource.Location on the correct floor. If the fence or location data does not include valid floor information, the floor is ignored and the fence is entered when it is intersected by the location.

A floor aware feature layer or table must be part of a GeoModel that includes a valid GeoModelFloorDefinition. All layers and tables that are used by the floor definition are loaded when the GeotriggerMonitor is started.

A Location can contain floor property as part of LocationDataSource.Location.getAdditionalSourceProperties().

Since:
100.12.0
  • Constructor Details

    • LocationGeotriggerFeed

      public LocationGeotriggerFeed()
      Constructs an empty LocationGeotriggerFeed.
      Since:
      100.12.0
    • LocationGeotriggerFeed

      public LocationGeotriggerFeed(LocationDataSource locationDataSource)
      Constructs a LocationGeotriggerFeed with a LocationDataSource.
      Parameters:
      locationDataSource - a location data source that provides updates for the device location
      Throws:
      IllegalArgumentException - if locationDataSource is null
      Since:
      100.12.0
  • Method Details

    • getFilter

      public ArcadeExpression getFilter()
      Gets an ArcadeExpression that controls whether an update from the LocationGeotriggerFeed is sent to a GeotriggerMonitor.

      The expression uses the Arcade language to determine whether feed entity updates are suitable for monitoring. The ArcadeExpression must evaluate to a boolean where:

      • True indicates that the update will be used.
      • False indicates that the update will not be used.
      Filtering out undesirable updates reduces inaccurate notifications from your GeotriggerMonitor. For example, you could filter out GPS updates where the horizontal accuracy is poor, to avoid false enter and exit notifications.

      With a LocationGeotriggerFeed, the expression inspects a new LocationDataSource.Location object and returns true if it is suitable and false if not. Typically, your expression excludes Location objects where the LocationDataSource.Location.getHorizontalAccuracy() does not meet your criteria - but it could also consider other properties such as LocationDataSource.Location.getVelocity() and LocationDataSource.Location.getCourse().

      Arcade gives you access to the properties of the feed entity with the $locationupdate profile variable. This represents a new Location received from your device GPS. For example, an ArcadeExpression with the following string rejects Location updates with a horizontal accuracy greater than 10 meters:

      return $locationupdate.horizontalaccuracy <= 10;.

      Returns:
      an ArcadeExpression that controls whether an update from the LocationGeotriggerFeed is sent to a GeotriggerMonitor, or null if none
      Since:
      100.13.0
      See Also:
    • setFilter

      public void setFilter(ArcadeExpression filter)
      Sets an ArcadeExpression that controls whether an update from the LocationGeotriggerFeed is sent to a GeotriggerMonitor.

      The expression uses the Arcade language to determine whether feed entity updates are suitable for monitoring. The ArcadeExpression must evaluate to a boolean where:

      • True indicates that the update will be used.
      • False indicates that the update will not be used.
      Filtering out undesirable updates reduces inaccurate notifications from your GeotriggerMonitor. For example, you could filter out GPS updates where the horizontal accuracy is poor, to avoid false enter and exit notifications.

      With a LocationGeotriggerFeed, the expression inspects a new LocationDataSource.Location object and returns true if it is suitable and false if not. Typically, your expression excludes Location objects where the LocationDataSource.Location.getHorizontalAccuracy() does not meet your criteria — but it could also consider other properties such as LocationDataSource.Location.getVelocity() and LocationDataSource.Location.getCourse().

      Arcade gives you access to the properties of the feed entity with the $locationupdate profile variable. This represents a new Location received from your device GPS. For example, an ArcadeExpression with the following string rejects Location updates with a horizontal accuracy greater than 10 meters:

      return $locationupdate.horizontalaccuracy <= 10;.

      Parameters:
      filter - an ArcadeExpression that controls whether an update from the LocationGeotriggerFeed is sent to a GeotriggerMonitor
      Since:
      100.13.0
      See Also:
    • getLocationDataSource

      public LocationDataSource getLocationDataSource()
      Gets the location data source that provides updates for the device location.

      To receive location updates, the underlying location data source must be started. If you call GeotriggerMonitor.stop(), the underlying LocationDataSource is not stopped for you. In other words, it may continue to receive GPS readings.

      Returns:
      the location data source that provides updates for the device location, or null if none
      Since:
      100.12.0
    • setLocationDataSource

      public void setLocationDataSource(LocationDataSource locationDataSource)
      Sets the location data source that provides updates for the device location.

      To receive location updates, the LocationDataSource.Status must be LocationDataSource.Status.STARTED. If you call GeotriggerMonitor.stop(), the underlying LocationDataSource is not stopped for you. In other words, it may continue to receive GPS readings.

      Parameters:
      locationDataSource - the location data source that provides updates for the device location
      Since:
      100.12.0