forceReload: true, // <-- [Android] If the user closes the app **while location-tracking is started** , reboot app (WARNING: possibly distruptive to user)
stopOnTerminate: false, // <-- [Android] Allow the background-service to run headless when user closes the app.
startOnBoot: true, // <-- [Android] Auto start background-service in headless mode when device is powered-up.
activityType: 'AutomotiveNavigation'
/**
* HTTP Feature: set an url to allow the native background service to POST locations to your server
// Turn ON the background-geolocation system. The user will be tracked whenever they suspend the app.
...
...
@@ -92,23 +100,24 @@ The plugin creates the object `window.plugins.backgroundGeoLocation` with the me
// If you wish to turn OFF background-tracking, call the #stop method.
// bgGeo.stop()
}
```
NOTE: The plugin includes `org.apache.cordova.geolocation` as a dependency. You must enable Cordova's GeoLocation in the foreground and have the user accept Location services by executing `#watchPosition` or `#getCurrentPosition`.
## Example Application

This plugin hosts a SampleApp in ```example/SampleApp``` folder. This SampleApp contains no plugins so you must first start by adding this plugin. **NOTE** In order to use the SampleApp, it's important to make a copy of it outside of the plugin itself.
This plugin hosts a SampleApp in ```example/SampleApp``` folder. This SampleApp contains no plugins so you must first start by adding its required plugins (most importantly, this one). **NOTE** In order to use the SampleApp, it's important to make a copy of it outside of the plugin itself.
If you're using XCode, boot the SampleApp in the iOS Simulator and enable ```Debug->Location->City Drive```.
## Help! It doesn't work!
Yes it does.
- on iOS, background tracking won't be engaged until you travel about **2-3 city blocks**, so go for a walk or car-ride (or use the Simulator with ```Debug->Location->City Drive```)
- Android is much quicker detecting movements; typically several meters of walking will do it.
- When in doubt, **nuke everything**: First delete the app from your device (or simulator)