Commit ea71a5b3 authored by Chris Scott's avatar Chris Scott

Update README.md

parent 1a2eea84
...@@ -61,11 +61,18 @@ The plugin creates the object `window.BackgroundGeolocation` with the methods ...@@ -61,11 +61,18 @@ The plugin creates the object `window.BackgroundGeolocation` with the methods
// As with all Cordova plugins, you must configure within an #deviceready callback. // As with all Cordova plugins, you must configure within an #deviceready callback.
// //
function onDeviceReady() { function onDeviceReady() {
// Get a reference to the plugin.
var bgGeo = window.BackgroundGeolocation;
/** /**
* This callback will be executed every time a geolocation is recorded in the background. * This callback will be executed every time a geolocation is recorded in the background.
*/ */
var callbackFn = function(location, taskId) { var callbackFn = function(location, taskId) {
console.log('[js] BackgroundGeoLocation callback: ' + location.latitude + ',' + location.longitude); var coords = location.coords;
var lat = coords.latitude;
var lng = coords.longitude;
console.log('[js] BackgroundGeoLocation callback: ' + JSON.stringify(location));
/** /**
* This would be your own callback for Ajax-requests after POSTing background geolocation to your server. * This would be your own callback for Ajax-requests after POSTing background geolocation to your server.
......
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