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)
// OLD callback args not supported.
BackgroundGeolocation.ready(config, (state) => {
console.log('[ready] state:', state);
});
// NEW: Only Promise API is supported:
BackgroundGeolocation.ready(config).then((state) => {
console.log('[ready] state', state);
});
// Or use await in an async function
const state = await BackgroundGeolocation.ready(config);
console.log('[ready] state'…


Google Play Console has introduced new guidelines for “Sensitive app permission”, such as android.permission.ACCESS_BACKGROUND_LOCATION, which the Background Geolocation SDK (for React Native, Flutter and Cordova/Capacitor) automatically adds to your app’s AndroidManifest. While submitting your app recently, you may find your app being rejected by Google Play Console with an email stating “Prominent disclosure not found”:

Do not be alarmed — Transistor Software has successfully submitted the Background Geolocation Demo app for Cordova, React Native and Flutter and all have been accepted. And you can too!

Step 1: Config.backgroundPermissionRationale

The latest version of the BackgroundGeolocation SDK (Flutter 1.10.1, React Native 3.9.1, Cordova 3.9.2) has…


The Background Geolocation SDK for React Native v3.9.0, Cordova v3.9.0 and Flutter v1.10.0 now includes support for iOS 14 and Android 11.

iOS 14

iOS 14 introduces yet another change to the location authorization dialog with a new “Precise” switch. This switch will default to “On”. If the user disables Precise location, location accuracy will be reduced to ~5000 meters and locations could be up to 20 minutes old.

If the user disables this switch, you will learn this in the onProviderChange event via new event-attribute ProviderChangeEvent.accuracyAuthorization

ProviderChangeEvent.accuracyAuthorization

However, iOS 14 now provides a new method to temporarily request full accuracy from…


CoronaTrace

The Background Geolocation SDK for Flutter, React Native, Cordova/Ionic/Capacitor was originally designed for a disaster-response application, tracking first-responders in hurricanes and earthquakes where life depended upon it. It was designed to track devices no matter what, regardless if user terminates the app or reboots the device. It is ideally suited to virus contact-tracing applications.

There are currently thousands of developers all over the world making their own flavour of “Corona Virus”-related app — Unless you’re associated with a government or health organization, your app will be rejected by both Apple and Google.

However, there is a project called Corona Trace


Android Q and iOS 13 support is available now for the Background Geolocation SDK:

iOS 13

iOS 13 introduces a radical new change to location authorization. No longer will apps be able to immediately request “Always” authorization.

Below is the new initial location authorization dialog presented by iOS 13— notice there’s no more “Allow Always” button:

iOS 13’s initial location authorization dialog.

When the user grants the most positive option on the dialog above, “Allow While Using App”, your app will be granted what’s called “Provisional Always Authorization” .


Version 3 of the Background Geolocation SDK for Cordova, React Native and Flutter (v1) is a significant refactor of the SDK’s Android Service architecture.

The Foreground Service

In the past, when BackgroundGeolocation.start() was executed, the Android SDK would launch a foreground-service (along with its required persistent notification). The foreground-service would remain running with its persistent notification until BackgroundGeolocation.stop() was executed.

One of the most common complaints, of course, was “How do I hide that notification?”

“Well, you can’t”, we would answer.

However, a way has been discovered to at least run the foreground-service only when the SDK is in the moving state, when…


The Background Geolocation SDK for Cordova and React Native now supports syncing with Firebase (currently only Firestore). This new Firebase Adapter is implemented within a separate plugin (cordova-background-geolocation-firebase and react-native-background-geolocation-firebase).

Implementing the Firebase Adapter will disable the Background Geolocation SDK’s internal persistence and HTTP services and sync directly with Firebase.


A great way to field-test the background-geolocation plugin is to use our test-server which we provide open-source at Github background-geolocation-console. It’s a simple node-server and web-application for quickly viewing your device tracking. It’s very easy to setup and configure the background-geolocation plugin to post to it.

The Background Geolocation sample-apps (Cordova, React Native) are already pre-configured to post to a hosted version of the tracking console at http://tracker.transistorsoft.com.

The background geolocation console is particularly useful for geofence-testing. Geofence transitions are marked by coloured dot on the geofence edge ) with a black polyline pointing to the triggering location.

  • Red: exit.


On Android, when you terminate your app with the BackgroundGeolocation plugin configured with stopOnTerminate: false, your Javascript code is completely terminated — only the plugin’s native Android background service continues running. If you’ve configured the plugin with an url, its Android background Service will continue posting locations to your server.

But what if you need to implement some custom business logic in the “headless” state, such as posting a local notification or executing getCurrentPositionin a heartbeat event?

The BackgroundGeolocation plugin for React Native and Cordova now provides a mechanism for you to implement your own custom code to handle all…


The Background Geolocation SDK is now available for Flutter!

flutter_background_geolocation

If you haven’t yet checked out Flutter, I highly recommend it. After spending a month porting the Background Geolocation SDK, this is by far the best development experience yet. Hot-reloading is painless and the integrated test-harness is great. UI layout is quick and easy. Flutter feels really good to develop with.

Using the SDK in Flutter is very similar to the Cordova, React Native and NativeScript APIs

Transistor Software

Creator of Background Geolocation SDK. Professional plugin developers — geolocation specialists. https://www.transistorsoft.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store