Summary: Methods | Inherited Methods | [Expand All]
public class

# GeofencingEvent

extends Object

java.lang.Object
↳ | com.google.android.gms.location.GeofencingEvent

## Class Overview

Represents an event from the `GeofencingApi` API. The event can be

- A geofence triggering event generated when a geofence transition happens.
- An error happens after geofences are registered and being monitored.

## Summary

Public Methods
static GeofencingEvent | fromIntent(Intent intent) Creates a `GeofencingEvent` object from the given intent.
int | getErrorCode() Returns the error code that explains the error that triggered the intent specified in `fromIntent(Intent)`.
int | getGeofenceTransition() Returns the transition type of the geofence transition alert.
List<Geofence> | getTriggeringGeofences() Returns a list of geofences that triggered this geofence transition alert.
Location | getTriggeringLocation() Gets the location that triggered the geofence transition.
boolean | hasError() Whether an error triggered this intent.

[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(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Public Methods

#### public static GeofencingEvent fromIntent (Intent intent)

Creates a `GeofencingEvent` object from the given intent.

##### Parameters

intent | the intent to extract the geofencing event data from

##### Returns

- a `GeofencingEvent` object or `null` if the given intent is `null`

#### public int getErrorCode ()

Returns the error code that explains the error that triggered the intent specified in `fromIntent(Intent)`.

##### Returns

- the error code specified in `GeofenceStatusCodes` or `-1` if `hasError()` returns `false`.

#### public int getGeofenceTransition ()

Returns the transition type of the geofence transition alert.

##### Returns

- -1 if the intent specified in `fromIntent(Intent)` is not generated for a transition alert; Otherwise returns the GEOFENCE_TRANSITION_ flags value defined in `Geofence`.

#### public List<Geofence> getTriggeringGeofences ()

Returns a list of geofences that triggered this geofence transition alert.

##### Returns

- a list of geofences that triggered this geofence transition alert or `null` if the intent specified in `fromIntent(Intent)` is not generated for a geofence transition alert

#### public Location getTriggeringLocation ()

Gets the location that triggered the geofence transition. Triggering location is only available if the calling app links against Google Play services 5.0 SDK.

##### Returns

- the location that triggered this geofence alert or `null` if it's not included in the intent specified in `fromIntent(Intent)`

#### public boolean hasError ()

Whether an error triggered this intent.

##### Returns

- `true` if an error triggered the intent specified in `fromIntent(Intent)`, otherwise `false`