Skip to content

HeadlessEvent Android only

Event delivered to a headless task registered via BackgroundGeolocation.registerHeadlessTask (React Native and Flutter). Cordova and Capacitor never deliver it to JavaScript: their headless events go to a native Android class instead — see AppConfig.enableHeadless.

Headless tasks allow the app to handle SDK events while running in the background without a UI — including after the app has been terminated by the user. Each task invocation receives a HeadlessEvent describing which SDK event occurred and carrying the associated payload.


Members

name

String name

The SDK event that triggered this headless task invocation (e.g. location, http, geofence, heartbeat, terminate).

Also locationerror, which has no listener of its own: in the foreground a location error reaches the failure callback of onLocation. On React Native its params is the LocationError code. For notificationaction, params is the buttonId of the tapped action.