public static final class

Geofence.Builder

extends Object
java.lang.Object
   ↳ com.steerpath.sdk.geofence.Geofence.Builder

Class Overview

Used for configuring and instantiating Geofence objects.

Summary

Public Constructors
Builder()
Public Methods
Geofence.Builder addBeacon(String beaconIdentifier, int rssi1m, float radius)
Defines that this geofence is actually a beaconfence.
Geofence.Builder addPolygon(JSONObject geojson)
Easily turn a GeoJSON object to a geofence.
Geofence.Builder addPolygonRegionExterior(double[][] lat_lon_pairs)
Defines that this geofence is a polygonal region with the exterior area defined by the parameters.
Geofence.Builder addPolygonRegionHole(double[][] lat_lon_pairs)
Defines a hole in this polygon.
Geofence build()
Instantiate a Geofence with the previously provided settings.
Geofence.Builder setCircularRegion(double latitude, double longitude, float radius)
Defines that this geofence is a circular region with a center point at the given coordinate and a radius of the set radius.
Geofence.Builder setExpirationDuration(long durationMillis)
This geofence will disappear after this time has elapsed.
Geofence.Builder setInfo(String info)
Defines additional user specified information tied to this geofence.
Geofence.Builder setLevelIndex(int levelIndex)
Set's the floor or level index on which this geofence should operate.
Geofence.Builder setLoiteringDelay(int loiteringDelayMs)
The time before a "dwelled" transition occurs after entry.
Geofence.Builder setNotificationResponsiveness(int notificationResponsivenessMs)
Currently not implemented.
Geofence.Builder setRequestId(String requestId)
The identifier for this geofence.
Geofence.Builder setTransitionTypes(int transitionTypes)
Which transitions are notified.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Builder ()

Public Methods

public Geofence.Builder addBeacon (String beaconIdentifier, int rssi1m, float radius)

Defines that this geofence is actually a beaconfence. ENTER and EXIT events are triggered when user reaches vicinity of the beacon. This means that physical beacon is required for testing the beaconfence. DWELL events are not valid for beaconfence.

Parameters
beaconIdentifier for example "u:af774f3518299426a456:00000000xxyy"
rssi1m you may obtain this value from Steerpath Meta. Otherwise you may use recommended default value which is -55.
radius in meters

public Geofence.Builder addPolygon (JSONObject geojson)

Easily turn a GeoJSON object to a geofence. Supports Polygons and MultiPolygons which can be inside Features, FeatureCollections and GeometryCollections. Holes in polygons are supported.

Parameters
geojson The geojson object to add as a geofence.
Returns
  • self
Throws
JSONException if the JSON isn't a valid GeoJSON or if the GeoJSON contains unsupported types.

public Geofence.Builder addPolygonRegionExterior (double[][] lat_lon_pairs)

Defines that this geofence is a polygonal region with the exterior area defined by the parameters.

Returns
  • an instance of this builder. Call build() to create the geofence.

public Geofence.Builder addPolygonRegionHole (double[][] lat_lon_pairs)

Defines a hole in this polygon.

Returns
  • an instance of this builder. Call build() to create the geofence.

public Geofence build ()

Instantiate a Geofence with the previously provided settings.

Returns
  • a new Geofence instance

public Geofence.Builder setCircularRegion (double latitude, double longitude, float radius)

Defines that this geofence is a circular region with a center point at the given coordinate and a radius of the set radius.

Parameters
latitude of the center of this geofence
longitude of the center point of this geofence
radius in meters
Returns
  • an instance of this builder. Call build() to create the geofence.

public Geofence.Builder setExpirationDuration (long durationMillis)

This geofence will disappear after this time has elapsed. Zero means the next time the geofencing api is initialized, -1 means never (including surviving reboot).

Returns
  • an instance of this builder. Call build() to create the geofence.

public Geofence.Builder setInfo (String info)

Defines additional user specified information tied to this geofence.

Parameters
info metadata to associate with this geofence.
Returns
  • an instance of this builder. Call build() to create the geofence.

public Geofence.Builder setLevelIndex (int levelIndex)

Set's the floor or level index on which this geofence should operate.

Parameters
levelIndex the level index for this geofence (default = 0)
Returns
  • an instance of this builder. Call build() to create the geofence.

public Geofence.Builder setLoiteringDelay (int loiteringDelayMs)

The time before a "dwelled" transition occurs after entry. Not valid with beacon fences.

Returns
  • an instance of this builder. Call build() to create the geofence.

public Geofence.Builder setNotificationResponsiveness (int notificationResponsivenessMs)

Currently not implemented.

Returns
  • an instance of this builder. Call build() to create the geofence.

public Geofence.Builder setRequestId (String requestId)

The identifier for this geofence. If none is set, a UUID will be generated.

Returns
  • an instance of this builder. Call build() to create the geofence.

public Geofence.Builder setTransitionTypes (int transitionTypes)

Which transitions are notified.

Parameters
transitionTypes default are ENTRY and EXIT
Returns
  • an instance of this builder. Call build() to create the geofence.