Skip to content

Instantly share code, notes, and snippets.

@christocracy
Last active October 11, 2016 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save christocracy/65bd674283dde9207e0fbe7ea96e5bd6 to your computer and use it in GitHub Desktop.
Save christocracy/65bd674283dde9207e0fbe7ea96e5bd6 to your computer and use it in GitHub Desktop.
Background Geolocation Geofencing
// Listen for geofence events.
bgGeo.on('geofence', function(params) {
console.log('- Geofence event: ', params.identifier);
});
// Add a geofence
bgGeo.addGeofences({
identifier: 'HOME',
radius: 200,
latitude: 45.51818958022214,
longitude: -73.61409989192487,
notifyOnEntry: true,
notifyOnExit: true
});
// Remove a geofence
bgGeo.removeGeofence("HOME");
// Fetch geofences
bgGeo.getGeofences(function(geofences) {
console.log('- Geofences: ', geofences);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment