GeofencingRequest.Builder | Android Developers

Quicknav Quicknav
Links

- Google Play Developer Console
- Android Developers Blog
- About Android

Android Sites

- Android.com
- Android Developers
- Android Open Source Project

Language
close

- - About
  - Wear
  - TV
  - Auto
- - Get Started
  - Devices
  - Style
  - Patterns
  - Building Blocks
  - Downloads
  - Videos
- - Training
  - API Guides
  - Reference
  - Tools
  - Google Services
  - Samples
- - Google Play
  - Essentials
  - Get Users
  - Engage & Retain
  - Monetize
  - Analyze
  - Tools & Reference
  - Developer Stories

## Results

Loading...
Summary: Ctors | Methods | Inherited Methods | [Expand All]
public static final class

# GeofencingRequest.Builder

extends Object

java.lang.Object
↳ | com.google.android.gms.location.GeofencingRequest.Builder

## Class Overview

A builder that builds `GeofencingRequest`.

## Summary

Public Constructors
| GeofencingRequest.Builder()

Public Methods
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.

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)

## 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

- a `GeofencingRequest` object

##### 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