public static final class

Geofence.Builder

extends Object
java.lang.Object
   ↳ com.google.android.gms.location.Geofence.Builder

Class Overview

A builder that builds Geofence.

Summary

Public Constructors
Geofence.Builder()
Public Methods
Geofence build()
Creates a geofence object.
Geofence.Builder setCircularRegion(double latitude, double longitude, float radius)
Sets the region of this geofence.
Geofence.Builder setExpirationDuration(long durationMillis)
Sets the expiration duration of geofence.
Geofence.Builder setRequestId(String requestId)
Sets the request ID of the geofence.
Geofence.Builder setTransitionTypes(int transitionTypes)
Sets the transition types of interest.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Geofence.Builder ()

Public Methods

public Geofence build ()

Creates a geofence object.

Throws
IllegalArgumentException if any parameters are not set or out of range

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

Sets the region of this geofence. The geofence represents a circular area on a flat, horizontal plane.

Parameters
latitude latitude in degrees, between -90 and +90 inclusive
longitude longitude in degrees, between -180 and +180 inclusive
radius radius in meters

public Geofence.Builder setExpirationDuration (long durationMillis)

Sets the expiration duration of geofence. This geofence will be removed automatically after this period of time.

Parameters
durationMillis time for this proximity alert, in milliseconds, or NEVER_EXPIRE to indicate no expiration. When positive, this geofence will be removed automatically after this amount of time.

public Geofence.Builder setRequestId (String requestId)

Sets the request ID of the geofence. Request ID is a string to identify this geofence inside your application. When two geofences with the same requestId are monitored, the new one will replace the old one regardless the geographical region these two geofences represent.

Parameters
requestId the request ID. The length of the string can be up to 100 characters.

public Geofence.Builder setTransitionTypes (int transitionTypes)

Sets the transition types of interest. Alerts are only generated for the given transition types.

Parameters
transitionTypes geofence transition types of interest, as a bitwise-OR of GEOFENCE_TRANSITION_ flags.