debug: true, // <-- enable this hear sounds for background-geolocation life-cycle.
desiredAccuracy: 0,
desiredAccuracy: 0,
stationaryRadius: 50,
stationaryRadius: 50,
distanceFilter: 50,
distanceFilter: 50,
...
@@ -101,20 +99,16 @@ function onDeviceReady() {
...
@@ -101,20 +99,16 @@ function onDeviceReady() {
fastestLocationUpdateInterval: 5000,
fastestLocationUpdateInterval: 5000,
activityRecognitionInterval: 10000,
activityRecognitionInterval: 10000,
stopTimeout: 0,
stopTimeout: 0,
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',
activityType: 'AutomotiveNavigation',
/**
// Application config
* HTTP Feature: set an url to allow the native background service to POST locations to your server
debug: true, // <-- enable this hear sounds for background-geolocation life-cycle.
*/
forceReloadOnLocationChange: false, // <-- [Android] If the user closes the app **while location-tracking is started** , reboot app when a new location is recorded (WARNING: possibly distruptive to user)
forceReloadOnMotionChange: false, // <-- [Android] If the user closes the app **while location-tracking is started** , reboot app when device changes stationary-state (stationary->moving or vice-versa) --WARNING: possibly distruptive to user)
forceReloadOnGeofence: false, // <-- [Android] If the user closes the app **while location-tracking is started** , reboot app when a geofence crossing occurs --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.
batchSync: true, // <-- [Default: false] Set true to sync locations to server in a single HTTP request.
batchSync: false, // <-- [Default: false] Set true to sync locations to server in 1 HTTP request.
autoSync: true,// <-- [Default: true] Set true to sync each location to server as it arrives.
autoSync: true,// <-- [Default: true] Set true to sync each location to server as it arrives.
maxDaysToPersist: 1, // <-- Maximum days to persist a location in plugin's SQLite database when HTTP fails
maxDaysToPersist: 1, // <-- Maximum days to persist a location in plugin's SQLite database when HTTP fails
headers: {
headers: {
"X-FOO": "bar"
"X-FOO": "bar"
...
@@ -138,8 +132,7 @@ function onDeviceReady() {
...
@@ -138,8 +132,7 @@ function onDeviceReady() {
A fully-featured [SampleApp](https://github.com/christocracy/cordova-background-geolocation-SampleApp) is available in its own public repo. After first cloning that repo, follow the installation instructions in the **README** there. This SampleApp includes a settings-screen allowing you to quickly experiment with all the different settings available for each platform.
A fully-featured [SampleApp](https://github.com/christocracy/cordova-background-geolocation-SampleApp) is available in its own public repo. After first cloning that repo, follow the installation instructions in the **README** there. This SampleApp includes a settings-screen allowing you to quickly experiment with all the different settings available for each platform.
Retrieves the current position. This method instructs the native code to fetch exactly one location using maximum power & accuracy. The native code will persist the fetched location to SQLite just as any other location in addition to POSTing to your configured `#url` (if you've enabled the HTTP features). In addition to your supplied `callbackFn`, the plugin will also execute the `callback` provided to `#configure`. Your provided `successFn` will be executed with the same signature as that provided to `#configure`:
######@param {Object} location The Location data
######@param {Integer} taskId The taskId used to send to bgGeo.finish(taskId) in order to signal completion of your callbackFn
Initiate or cancel immediate background tracking. When set to ```true```, the plugin will begin aggressively tracking the devices Geolocation, bypassing stationary monitoring. If you were making a "Jogging" application, this would be your [Start Workout] button to immediately begin GPS tracking. Send ```false``` to disable aggressive GPS monitoring and return to stationary-monitoring mode.
Initiate or cancel immediate background tracking. When set to ```true```, the plugin will begin aggressively tracking the devices Geolocation, bypassing stationary monitoring. If you were making a "Jogging" application, this would be your [Start Workout] button to immediately begin GPS tracking. Send ```false``` to disable aggressive GPS monitoring and return to stationary-monitoring mode.
Your ```callbackFn``` will be executed each time the device has changed-state between **MOVING** or **STATIONARY. The ```callbackFn``` will be provided with a ```Location``` object as the 1st param, with the usual params (```latitude, longitude, accuracy, speed, bearing, altitude```), in addition to a ```taskId``` used to signal that your callback is finished.
######@param {Boolean} isMoving `false` if entered **STATIONARY** mode; `true` if entered **MOVING** mode.
######@param {Object} location The location at the state-change.
######@param {Integer} taskId The taskId used to send to bgGeo.finish(taskId) in order to signal completion of your callbackFn
console.log('Device has just started MOVING', location);
} else {
console.log('Device has just STOPPED', location);
}
bgGeo.finish(taskId);
})
```
####`onStationary(callbackFn, failureFn)`
**DEPRECATED**— Use [onMotionChange](https://github.com/christocracy/cordova-background-geolocation/tree/trigger-activities#onmotionchangecallbackfn-failurefn) instead.
Your ```callbackFn``` will be executed each time the device has entered stationary-monitoring mode. The ```callbackFn``` will be provided with a ```Location``` object as the 1st param, with the usual params (```latitude, longitude, accuracy, speed, bearing, altitude```), in addition to a ```taskId``` used to signal that your callback is finished.
Your ```callbackFn``` will be executed each time the device has entered stationary-monitoring mode. The ```callbackFn``` will be provided with a ```Location``` object as the 1st param, with the usual params (```latitude, longitude, accuracy, speed, bearing, altitude```), in addition to a ```taskId``` used to signal that your callback is finished.
######@param {Object} location The Location data
######@param {Object} location The Location data
...
@@ -691,29 +651,13 @@ An interval of 0 is allowed, but not recommended, since location updates may be
...
@@ -691,29 +651,13 @@ An interval of 0 is allowed, but not recommended, since location updates may be
the desired time between activity detections. Larger values will result in fewer activity detections while improving battery life. A value of 0 will result in activity detections at the fastest possible rate.
the desired time between activity detections. Larger values will result in fewer activity detections while improving battery life. A value of 0 will result in activity detections at the fastest possible rate.
Each activity-recognition-result returned by the API is tagged with a "confidence" level expressed as a %. You can set your desired confidence to trigger a state-change. Defaults to `80`.
####`@param {String} triggerActivities`
These are the comma-delimited list of [activity-names](https://developers.google.com/android/reference/com/google/android/gms/location/DetectedActivity) returned by the `ActivityRecognition` API which will trigger a state-change from **stationary** to **moving**. By default, this list is set to all five **moving-states**: `"in_vehicle, on_bicycle, on_foot, running, walking"`. If you wish, you could configure the plugin to only engage **moving-mode** for vehicles by providing only `"in_vehicle"`.
####`@param {Integer minutes} stopTimeout`
####`@param {Integer minutes} stopTimeout`
The number of miutes to wait before turning off the GPS after the ActivityRecognition System (ARS) detects the device is ```STILL``` (defaults to 0, no timeout). If you don't set a value, the plugin is eager to turn off the GPS ASAP. An example use-case for this configuration is to delay GPS OFF while in a car waiting at a traffic light.
The number of miutes to wait before turning off the GPS after the ActivityRecognition System (ARS) detects the device is ```STILL``` (defaults to 0, no timeout). If you don't set a value, the plugin is eager to turn off the GPS ASAP. An example use-case for this configuration is to delay GPS OFF while in a car waiting at a traffic light.
####`@param {Boolean} forceReloadOnMotionChange`
####`@param {Boolean} forceReload`
If the user closes the application while the background-tracking has been started, location-tracking will continue on if ```stopOnTerminate: false```. You may choose to force the foreground application to reload (since this is where your Javascript runs). `forceReloadOnMotionChange: true` will reload the app only when a state-change occurs from **stationary -> moving** or vice-versa. (**WARNING** possibly disruptive to user).
If the user closes the application while the background-tracking has been started, location-tracking will continue on if ```stopOnTerminate: false```. You may choose to force the foreground application to reload (since this is where your Javascript runs). `forceReloadOnLocationChange: true` will reload the app when a new location is recorded.
####`@param {Boolean} forceReloadOnGeofence`
If the user closes the application while the background-tracking has been started, location-tracking will continue on if ```stopOnTerminate: false```. You may choose to force the foreground application to reload (since this is where your Javascript runs). `forceReloadOnGeolocation: true` will reload the app only when a geofence crossing event has occurred.
If the user closes the application while the background-tracking has been started, location-tracking will continue on if ```stopOnTerminate: false```. You may choose to force the foreground application to reload (since this is where your Javascript runs) by setting ```foreceReload: true```. This will guarantee that locations are always sent to your Javascript callback (**WARNING** possibly disruptive to user).
debug:true,// <-- enable this hear sounds for background-geolocation life-cycle.
desiredAccuracy:0,
desiredAccuracy:0,
stationaryRadius:50,
stationaryRadius:50,
distanceFilter:50,
distanceFilter:50,
...
@@ -178,17 +206,13 @@ var app = {
...
@@ -178,17 +206,13 @@ var app = {
fastestLocationUpdateInterval:5000,
fastestLocationUpdateInterval:5000,
activityRecognitionInterval:10000,
activityRecognitionInterval:10000,
stopTimeout:0,
stopTimeout:0,
forceReload:false,// <-- [Android] If the user closes the app **while location-tracking is started** , reboot app (WARNING: possibly distruptive to user)
stopOnTerminate:true,// <-- [Android] Allow the background-service to run headless when user closes the app.
startOnBoot:false,// <-- [Android] Auto start background-service in headless mode when device is powered-up.
activityType:'AutomotiveNavigation',
activityType:'AutomotiveNavigation',
/**
// Application config
* HTTP Feature: set an url to allow the native background service to POST locations to your server
debug:true,// <-- enable this hear sounds for background-geolocation life-cycle.
*/
forceReloadOnLocationChange:false,// <-- [Android] If the user closes the app **while location-tracking is started** , reboot app when a new location is recorded (WARNING: possibly distruptive to user)
forceReloadOnMotionChange:false,// <-- [Android] If the user closes the app **while location-tracking is started** , reboot app when device changes stationary-state (stationary->moving or vice-versa) --WARNING: possibly distruptive to user)
forceReloadOnGeofence:false,// <-- [Android] If the user closes the app **while location-tracking is started** , reboot app when a geofence crossing occurs --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.
* Add a stationary-region listener. Whenever the devices enters "stationary-mode", your #success callback will be executed with #location param containing #radius of region
* Add a stationary-region listener. Whenever the devices enters "stationary-mode", your #success callback will be executed with #location param containing #radius of region
* @deprecated in favour of dual-function #onMotionChange
* @param {Function} success
* @param {Function} success
* @param {Function} failure [optional] NOT IMPLEMENTED
* @param {Function} failure [optional] NOT IMPLEMENTED
*/
*/
...
@@ -137,35 +136,6 @@ module.exports = {
...
@@ -137,35 +136,6 @@ module.exports = {
'addStationaryRegionListener',
'addStationaryRegionListener',
[]);
[]);
},
},
/**
* Add a movement-state-change listener. Whenever the devices enters "stationary" or "moving" mode, your #success callback will be executed with #location param containing #radius of region
* @param {Function} success
* @param {Function} failure [optional] NOT IMPLEMENTED