GeofencingRequest.Builder

public static final class GeofencingRequest.Builder extends Object

A builder that builds GeofencingRequest.Pending

Public Constructor Summary

Public Method Summary

GeofencingRequest.Builder
addGeofence(Geofence geofence)
Adds a geofence to be monitored by geofencing service.
GeofencingRequest.Builder
addGeofences(List<Geofence> geofences)
Adds all the geofences in the given list to be monitored by geofencing service.
GeofencingRequest
build()
Builds the GeofencingRequest object.
GeofencingRequest.Builder
setInitialTrigger(int initialTrigger)
Sets the geofence notification behavior at the moment when the geofences are added.

Inherited Method Summary

Public Constructors

public GeofencingRequest.Builder ()

Public Methods

public GeofencingRequest.Builder addGeofence (Geofence geofence)

Adds a geofence to be monitored by geofencing service.

Parameters
geofence the geofence to be monitored. The geofence must be built with Geofence.Builder.
Returns
  • the builder object itself for method chaining
Throws
IllegalArgumentException if the geofence is not built with Geofence.Builder.
NullPointerException if the given geofence is null

public GeofencingRequest.Builder addGeofences (List<Geofence> geofences)

Adds all the geofences in the given list to be monitored by geofencing service.

Parameters
geofences the geofences to be monitored. The geofences in the list must be built with Geofence.Builder.
Returns
  • the builder object itself for method chaining
Throws
IllegalArgumentException if the geofence is not built with Geofence.Builder.

public GeofencingRequest build ()

Builds the GeofencingRequest object.

Returns
Throws
IllegalArgumentException if no geofence has been added to this list

public GeofencingRequest.Builder setInitialTrigger (int initialTrigger)

Sets the geofence notification behavior at the moment when the geofences are added. The default behavior is INITIAL_TRIGGER_ENTER and INITIAL_TRIGGER_DWELL.

Parameters
initialTrigger the notification behavior. It's a bit-wise of INITIAL_TRIGGER_ENTER and/or INITIAL_TRIGGER_EXIT and/or INITIAL_TRIGGER_DWELL.
Returns
  • the builder object itself for method chaining