Commit dc158892 authored by Chris Scott's avatar Chris Scott

Update README

parent a5d7be43
...@@ -18,6 +18,7 @@ The plugin creates the object `window.plugins.backgroundGeoLocation` with the me ...@@ -18,6 +18,7 @@ The plugin creates the object `window.plugins.backgroundGeoLocation` with the me
``` ```
phonegap plugin add https://github.com/christocracy/cordova-plugin-background-geolocation.git phonegap plugin add https://github.com/christocracy/cordova-plugin-background-geolocation.git
``` ```
3. 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`.
A full example could be: A full example could be:
``` ```
...@@ -28,22 +29,28 @@ A full example could be: ...@@ -28,22 +29,28 @@ A full example could be:
$.post({ $.post({
url: 'locations.json', url: 'locations.json',
callback: function() { callback: function() {
// Must inform native plugin the task is complete so it can terminate background-thread and go back to sleep. // N.B: You MUST inform native plugin the task is complete so it can terminate background-thread and go back to sleep.
bgGeo.finish(); bgGeo.finish(); // <-- DO NOT FORGET TO DO THIS!!!!!!!!!!!!!!!!!!!!!!!
} }
}) })
}; };
bgGeo.configure(callback, failFn, { bgGeo.configure(callback, failFn, {
stationaryRadius: 50, // meters stationaryRadius: 50, // meters
distanceFilter: 50 // meters distanceFilter: 50, // meters
debug: true // enables sounds for bg-tracking events for debugging.
}); });
// Enable background geolocation // Enable background geolocation
bgGeo.start(); bgGeo.start();
// Disable it .
bgGeo.stop(); .
.
// When you want to stop tracking the user in the background, simply execute
// bgGeo.stop();
``` ```
...@@ -56,13 +63,6 @@ using [standard location services](https://developer.apple.com/library/mac/docum ...@@ -56,13 +63,6 @@ using [standard location services](https://developer.apple.com/library/mac/docum
Both #distanceFilter and #stationaryRadius can be modified at run-time. For example, a #distanceFilter of 50m works great for walking-speed, but is probably too low for a car at highway-speed (too many samples). In the future, the native app could possibly intelligently monitor speed and vary #distanceFilter automatically. For now, you must control this manually. Both #distanceFilter and #stationaryRadius can be modified at run-time. For example, a #distanceFilter of 50m works great for walking-speed, but is probably too low for a car at highway-speed (too many samples). In the future, the native app could possibly intelligently monitor speed and vary #distanceFilter automatically. For now, you must control this manually.
```
bgGeo.setStationaryRadius(100);
bgGeo.setDistanceFilter(500);
```
With aggressive location-monitoring enabled, if the user stops for exactly 15 minutes, iOS will automatically send a signal to the native-plugin which will turn-off standard location services and once again begin region-monitoring (#stationaryRadius) using the iOS significant-changes api. With aggressive location-monitoring enabled, if the user stops for exactly 15 minutes, iOS will automatically send a signal to the native-plugin which will turn-off standard location services and once again begin region-monitoring (#stationaryRadius) using the iOS significant-changes api.
## Android ## Android
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment