Skip to content

GeofenceEvent

export interface GeofenceEvent {

Geofence transition delivered to BackgroundGeolocation.onGeofence.

The SDK fires this event each time the device crosses a monitored geofence boundary. Each event carries the transition type (ENTER, EXIT, or DWELL), the location recorded at the moment of the crossing, and the full Geofence record that triggered it.

BackgroundGeolocation.onGeofence((event) => {
  console.log(
    "[onGeofence]",
    event.identifier,
    event.action,
    event.location
  );
});

Members

action

action:GeofenceAction;

Transition type that fired: ENTER, EXIT, or DWELL.

extras

extras?: Record<string, any>;

Optional metadata originally configured on the Geofence. Present only when the geofence was created with an extras map.

geofence

geofence?:Geofence;

The complete Geofence record that triggered this event.

identifier

identifier: string;

The Geofence.identifier of the geofence that triggered this event.

location

location:Location;

Location recorded at the moment the geofence boundary was crossed.

timestamp

timestamp: string;

ISO-8601 UTC timestamp from the device system clock at the moment the OS delivered the geofence event.