Capacitor Support for Background Geolocation

Both background-geolocation and background-fetch now have pure Capacitor implementations!

See the Github repos:

The Javascript API is almost identical to the Cordova version, with just one caveat: you must use the Promise api only. For example:

// Old API with optional callbacks as method-arguments is
// no longer supported, eg: methodName(successFn)
// use Promise api, eg: methodName().then(successFn)

However, adding event-listeners never returned a Promise — those do accept a callback argument, just as in the Cordova version — there is no difference with adding event-listeners between the Cordova and Capacitor version.

// Adding event-listeners is the same as always:
BackgroundGeolocation.onLocation((location) => {
console.log('[onLocation]', location);
}, (error) => {
console.log('[onLocation] ERROR', error);

Creator of Background Geolocation SDK. Professional plugin developers — geolocation specialists.