Skip to content

Instantly share code, notes, and snippets.

@christocracy
Last active May 24, 2024 15:22
Show Gist options
  • Select an option

  • Save christocracy/65bd674283dde9207e0fbe7ea96e5bd6 to your computer and use it in GitHub Desktop.

Select an option

Save christocracy/65bd674283dde9207e0fbe7ea96e5bd6 to your computer and use it in GitHub Desktop.

Revisions

  1. christocracy revised this gist May 24, 2024. 1 changed file with 6 additions and 5 deletions.
    11 changes: 6 additions & 5 deletions geofencing.js
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    // Listen for geofence events.
    bgGeo.on('geofence', function(params) {
    BackgroundGeolocation.onGeofence((params) => {
    console.log('- Geofence event: ', params.identifier);
    });
    // Add a geofence
    bgGeo.addGeofences({
    await BackgroundGeolocation.addGeofence({
    identifier: 'HOME',
    radius: 200,
    latitude: 45.51818958022214,
    @@ -12,8 +12,9 @@ bgGeo.addGeofences({
    notifyOnExit: true
    });
    // Remove a geofence
    bgGeo.removeGeofence("HOME");
    await BackgroundGeolocation.removeGeofence("HOME");
    // Fetch geofences
    bgGeo.getGeofences(function(geofences) {
    BackgroundGeolocation.getGeofences((geofences) => {
    console.log('- Geofences: ', geofences);
    });
    });

  2. christocracy revised this gist Oct 11, 2016. 1 changed file with 0 additions and 3 deletions.
    3 changes: 0 additions & 3 deletions geofencing.js
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,6 @@
    bgGeo.on('geofence', function(params) {
    console.log('- Geofence event: ', params.identifier);
    });

    // Add a geofence
    bgGeo.addGeofences({
    identifier: 'HOME',
    @@ -12,10 +11,8 @@ bgGeo.addGeofences({
    notifyOnEntry: true,
    notifyOnExit: true
    });

    // Remove a geofence
    bgGeo.removeGeofence("HOME");

    // Fetch geofences
    bgGeo.getGeofences(function(geofences) {
    console.log('- Geofences: ', geofences);
  3. christocracy revised this gist Oct 11, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion geofencing.js
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ bgGeo.on('geofence', function(params) {
    });

    // Add a geofence
    bgGeo.addGeofence({
    bgGeo.addGeofences({
    identifier: 'HOME',
    radius: 200,
    latitude: 45.51818958022214,
  4. christocracy revised this gist Sep 1, 2016. 1 changed file with 6 additions and 1 deletion.
    7 changes: 6 additions & 1 deletion geofencing.js
    Original file line number Diff line number Diff line change
    @@ -14,4 +14,9 @@ bgGeo.addGeofence({
    });

    // Remove a geofence
    bgGeo.removeGeofence("HOME");
    bgGeo.removeGeofence("HOME");

    // Fetch geofences
    bgGeo.getGeofences(function(geofences) {
    console.log('- Geofences: ', geofences);
    });
  5. christocracy created this gist Sep 1, 2016.
    17 changes: 17 additions & 0 deletions geofencing.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    // Listen for geofence events.
    bgGeo.on('geofence', function(params) {
    console.log('- Geofence event: ', params.identifier);
    });

    // Add a geofence
    bgGeo.addGeofence({
    identifier: 'HOME',
    radius: 200,
    latitude: 45.51818958022214,
    longitude: -73.61409989192487,
    notifyOnEntry: true,
    notifyOnExit: true
    });

    // Remove a geofence
    bgGeo.removeGeofence("HOME");