GeofencingRequest.Builder

  • GeofencingRequest.Builder is used to construct GeofencingRequest objects for geofencing operations.

  • You can add individual or multiple geofences to the request using addGeofence and addGeofences methods respectively.

  • The setInitialTrigger method configures the initial geofence notification behavior when geofences are added.

  • The build method finalizes the request and returns a GeofencingRequest instance, requiring at least one geofence to have been added beforehand.

public static final class GeofencingRequest.Builder extends Object

A builder for GeofencingRequest.

Public Constructor Summary

Public Method Summary

GeofencingRequest.Builder
addGeofence(Geofence geofence)
Adds a geofence to the request.
GeofencingRequest.Builder
addGeofences(List<? extends Geofence> geofences)
Adds the given geofences to the request.
GeofencingRequest
build()
Builds the GeofencingRequest.
GeofencingRequest.Builder
setInitialTrigger(int initialTrigger)
Sets the geofence notification behavior at the moment when the geofences are added.

Inherited Method Summary

Public Constructors

public Builder ()

Public Methods

public GeofencingRequest.Builder addGeofence (Geofence geofence)

Adds a geofence to the request.

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

Adds the given geofences to the request.

public GeofencingRequest build ()

Builds the GeofencingRequest. At least one geofence must have been added to the GeofencingRequest.Builder.

public GeofencingRequest.Builder setInitialTrigger (int initialTrigger)

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

Parameters
initialTrigger the notification behavior. Should be a bit-wise of GeofencingRequest#INITIAL_TRIGGER_ options.