GeofencingEvent

public classGeofencingEventextendsObject

Represents an event from theGeofencingClient 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.

Public Method Summary

staticGeofencingEvent
fromIntent(Intent intent)
Creates aGeofencingEvent 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.

Inherited Method Summary

Public Methods

public staticGeofencingEvent fromIntent(Intent intent)

Creates aGeofencingEvent object from the given intent.

Parameters
intent the intent to extract the geofencing event data from
Returns
  • aGeofencingEvent object ornullif the given intent isnullor doesn't contain geofencing event.

public intgetErrorCode()

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

Returns

public intgetGeofenceTransition()

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 inGeofence.

publicList<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 nullif the intent specified in fromIntent(Intent)is not generated for a geofence transition alert

publicLocation getTriggeringLocation()

Gets the location that triggered the geofence transition.

Returns
  • the location that triggered this geofence alert ornullif it's not included in the intent specified in fromIntent(Intent)

public booleanhasError()

Whether an error triggered this intent.

Returns